Skip to content

Commit

Permalink
v1.8.1 (#340)
Browse files Browse the repository at this point in the history
* fix(callFirestore): apply `where` clause to `delete` action - #307
* build(deps-dev): update `eslint` v7.18.0 to v7.25.0 (#335)
* build(deps-dev): bump `@typescript-eslint/parser` from 4.14.0 to 4.22.0
* build(deps-dev): bump `size-limit` from 4.9.1 to 4.10.2 (#324)
* build(deps): bump `y18n` from 4.0.0 to 4.0.1 (#321)
* build(deps): bump `elliptic` from 6.5.3 to 6.5.4 (#308)
* build(deps): bump `ssri` from 6.0.1 to 6.0.2 (#339)
  • Loading branch information
prescottprue authored May 2, 2021
1 parent fe14ad9 commit c9bb477
Show file tree
Hide file tree
Showing 7 changed files with 621 additions and 520 deletions.
6 changes: 0 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,6 @@ declare module "extendWithFirebaseConfig" {
export default function extendWithFirebaseConfig(cypressConfig: CypressConfig): ExtendedCypressConfig;
}
declare module "node-utils" {
/**
* Read a file from the filesystem and JSON.parse contents
* @param filePath - Path for file
* @returns Firebase settings object
*/
export function readJsonFile(filePath: string): any;
interface ServiceAccount {
type: string;
project_id: string;
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress-firebase",
"version": "1.8.0",
"version": "1.8.1",
"description": "Utilities to help testing Firebase projects with Cypress.",
"main": "lib/index.js",
"module": "lib/index.js",
Expand Down Expand Up @@ -29,26 +29,26 @@
"firebase-admin": "^8 || ^9"
},
"devDependencies": {
"@firebase/rules-unit-testing": "^1.1.9",
"@firebase/rules-unit-testing": "^1.2.10",
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@size-limit/preset-small-lib": "^4.9.1",
"@types/chai": "^4.2.14",
"@size-limit/preset-small-lib": "^4.10.2",
"@types/chai": "^4.2.17",
"@types/mocha": "^8.2.0",
"@types/node": "^14.14.22",
"@types/sinon-chai": "^3.2.5",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"chai": "^4.2.0",
"eslint": "^7.18.0",
"eslint": "^7.25.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^31.3.3",
"eslint-plugin-jsdoc": "^33.0.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"firebase-admin": "^9.4.1",
"firebase-tools": "^9.2.2",
"eslint-plugin-prettier": "^3.4.0",
"firebase-admin": "^9.7.0",
"firebase-tools": "^9.10.0",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"mocha": "^8.2.1",
Expand All @@ -57,7 +57,7 @@
"rimraf": "^3.0.2",
"sinon": "^9.2.4",
"sinon-chai": "^3.5.0",
"size-limit": "^4.9.1",
"size-limit": "^4.10.2",
"source-map-support": "^0.5.19",
"ts-node": "^9.0.0",
"typescript": "^4.1.3"
Expand Down
4 changes: 2 additions & 2 deletions src/attachCustomCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ export default function attachCustomCommands(
}
taskSettings.data = dataToWrite;
}
// Use third argument as options for get action
if (action === 'get') {
// Use third argument as options for get and delete actions
if (action === 'get' || action === 'delete') {
taskSettings.options = dataOrOptions;
} else if (options) {
// Attach options if they exist
Expand Down
8 changes: 4 additions & 4 deletions src/firebase-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ export function initializeFirebase(
const { FIREBASE_DATABASE_EMULATOR_HOST } = process.env;
const fbConfig: any = {
projectId,
// Initialize RTDB with databaseURL pointed to emulator if FIREBASE_DATABASE_EMULATOR_HOST is set
databaseURL: FIREBASE_DATABASE_EMULATOR_HOST
? `http://${FIREBASE_DATABASE_EMULATOR_HOST}?ns=${projectId || 'local'}`
: `https://${projectId}.firebaseio.com`,
...overrideConfig,
};

if (FIREBASE_DATABASE_EMULATOR_HOST) {
// Initialize RTDB with databaseURL pointed to emulator if FIREBASE_DATABASE_EMULATOR_HOST is set
fbConfig.databaseURL = `http://${FIREBASE_DATABASE_EMULATOR_HOST}?ns=${
projectId || 'local'
}`;
/* eslint-disable no-console */
console.log(
'cypress-firebase: Using RTDB emulator with DB URL:',
Expand Down
2 changes: 1 addition & 1 deletion src/node-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { existsSync, readFileSync } from 'fs';
* @param filePath - Path for file
* @returns Firebase settings object
*/
export function readJsonFile(filePath: string): any {
function readJsonFile(filePath: string): any {
if (!existsSync(filePath)) {
return {};
}
Expand Down
3 changes: 2 additions & 1 deletion src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ export function callFirestore(
actionPath,
options,
) as FirebaseFirestore.DocumentReference).delete()
: deleteCollection(
: // TODO: Here the ref should be passed along instead so we can accept options
deleteCollection(
adminInstance.firestore(),
actionPath,
options?.batchSize,
Expand Down
Loading

0 comments on commit c9bb477

Please sign in to comment.