Skip to content

Commit f1f0bca

Browse files
authored
v1.4.4 (#155)
* fix(types): remove usage of `Function` type (instead provide function signature) * chore(deps): update dev dependencies including eslint, @typescript-eslint and @firebase/testing * chore(deps): add dependabot settings for automatic creation of dep update PRs * chore(core): add github issue and PR templates * chore(core): add .opensource folder for firebaseopensource.com
1 parent 5672a92 commit f1f0bca

14 files changed

+786
-362
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
},
2727
rules: {
2828
'@typescript-eslint/no-explicit-any': 0,
29+
'@typescript-eslint/explicit-module-boundary-types': 0,
2930
'import/prefer-default-export': 0,
3031
'no-shadow': 0,
3132
'consistent-return': 0,

.github/ISSUE_TEMPLATE/bug_report.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
---
5+
6+
**Describe the bug**
7+
8+
<!-- A clear and concise description of what the bug is. -->
9+
10+
**To Reproduce**
11+
Steps to reproduce the behavior:
12+
13+
<!--
14+
1. Go to '...'
15+
1. Click on '....'
16+
1. Scroll down to '....'
17+
1. See error
18+
-->
19+
20+
**Expected behavior/code**
21+
A clear and concise description of what you expected to happen (or code).
22+
23+
**Possible Solution**
24+
25+
<!--- Only if you have suggestions on a fix for the bug -->
26+
27+
**Additional Context/Screenshots**
28+
29+
<!-- Add any other context about the problem here. If applicable, add screenshots to help explain. -->
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
---
5+
6+
**Is your feature request related to a problem? Please describe.**
7+
8+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
9+
10+
**Describe the solution you'd like**
11+
12+
<!-- A clear and concise description of what you want to happen. -->
13+
14+
**Describe alternatives you've considered**
15+
16+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
17+
18+
**Additional context**
19+
20+
<!-- Add any other context or screenshots about the feature request here. -->

.github/PULL_REQUEST_TEMPLATE.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Description
2+
3+
### Screenshots (if appropriate)

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# For for information on config options, visit docs:
2+
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
3+
version: 2
4+
updates:
5+
- package-ecosystem: "npm"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"

.opensource/project.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "cypress-firebase",
3+
"platforms": ["Web"],
4+
"content": "README.md",
5+
"related": [
6+
"firebase/firebase-js-sdk",
7+
"firebase/firebase-admin-node",
8+
"cypress-io/cypress"
9+
],
10+
"tabs": [
11+
{ "title": "NPM", "href": "https://npmjs.com/package/cypress-firebase" },
12+
{
13+
"title": "API Reference",
14+
"href": "https://github.com/prescottprue/cypress-firebase/blob/master/README.md"
15+
}
16+
]
17+
}

index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ declare module "plugin" {
335335
* @param adminInstance - firebase-admin instance
336336
* @returns Extended Cypress config
337337
*/
338-
export default function pluginWithTasks(cypressOnFunc: Function, cypressConfig: any, adminInstance: any): ExtendedCypressConfig;
338+
export default function pluginWithTasks(cypressOnFunc: any, cypressConfig: any, adminInstance: any): ExtendedCypressConfig;
339339
}
340340
declare module "index" {
341341
import attachCustomCommands from "attachCustomCommands";

package.json

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cypress-firebase",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"description": "Utilities to help testing Firebase projects with Cypress.",
55
"main": "lib/index.js",
66
"module": "lib/index.js",
@@ -29,37 +29,37 @@
2929
"firebase-admin": "^8 || ^9"
3030
},
3131
"devDependencies": {
32-
"@firebase/testing": "^0.20.9",
32+
"@firebase/testing": "^0.20.11",
3333
"@istanbuljs/nyc-config-typescript": "^1.0.1",
34-
"@size-limit/preset-small-lib": "^4.5.5",
35-
"@types/chai": "^4.2.11",
36-
"@types/mocha": "^8.0.0",
37-
"@types/node": "^14.0.24",
34+
"@size-limit/preset-small-lib": "^4.5.6",
35+
"@types/chai": "^4.2.12",
36+
"@types/mocha": "^8.0.2",
37+
"@types/node": "^14.0.27",
3838
"@types/sinon-chai": "^3.2.4",
39-
"@typescript-eslint/eslint-plugin": "^2.34.0",
40-
"@typescript-eslint/parser": "^2.34.0",
39+
"@typescript-eslint/eslint-plugin": "^3.9.0",
40+
"@typescript-eslint/parser": "^3.9.0",
4141
"chai": "^4.2.0",
42-
"eslint": "^7.5.0",
42+
"eslint": "^7.7.0",
4343
"eslint-config-airbnb-base": "^14.2.0",
4444
"eslint-config-prettier": "^6.11.0",
45-
"eslint-plugin-babel": "^5.3.0",
45+
"eslint-plugin-babel": "^5.3.1",
4646
"eslint-plugin-import": "^2.22.0",
47-
"eslint-plugin-jsdoc": "^30.0.3",
47+
"eslint-plugin-jsdoc": "^30.2.2",
4848
"eslint-plugin-jsx-a11y": "^6.3.1",
49-
"eslint-plugin-prettier": "^3.1.3",
50-
"firebase-admin": "^9.0.0",
51-
"firebase-tools": "^8.6.0",
49+
"eslint-plugin-prettier": "^3.1.4",
50+
"firebase-admin": "^9.1.0",
51+
"firebase-tools": "^8.7.0",
5252
"husky": "^4.2.5",
5353
"lint-staged": "^10.2.11",
54-
"mocha": "^8.0.1",
54+
"mocha": "^8.1.1",
5555
"nyc": "^15.1.0",
5656
"prettier": "^2.0.5",
5757
"rimraf": "^3.0.2",
58-
"sinon": "^9.0.2",
58+
"sinon": "^9.0.3",
5959
"sinon-chai": "^3.5.0",
60-
"size-limit": "^4.5.5",
60+
"size-limit": "^4.5.6",
6161
"source-map-support": "^0.5.19",
62-
"ts-node": "^8.10.1",
62+
"ts-node": "^8.10.2",
6363
"typescript": "^3.9.7"
6464
},
6565
"keywords": [

src/attachCustomCommands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export default function attachCustomCommands(
322322
Cypress.Commands.add(
323323
options?.commandNames?.logout || 'logout',
324324
(): Promise<any> => {
325-
return new Promise((resolve: Function, reject: Function): any => {
325+
return new Promise((resolve: () => any, reject: () => any): any => {
326326
firebase.auth().onAuthStateChanged((auth: any) => {
327327
if (!auth) {
328328
resolve();

src/firebase-utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function initializeFirebase(adminInstance: any): admin.app.App {
6060
process.env.GCLOUD_PROJECT ||
6161
process.env.FIREBASE_PROJECT ||
6262
process.env.FIREBASE_PROJECT_ID ||
63-
serviceAccount?.project_id;
63+
serviceAccount?.project_id; // eslint-disable-line camelcase
6464
const fbConfig: any = {
6565
projectId,
6666
};
@@ -101,7 +101,7 @@ export function initializeFirebase(adminInstance: any): admin.app.App {
101101
// Get service account from local file falling back to environment variables
102102
const serviceAccount = getServiceAccount();
103103
const projectId =
104-
process.env.GCLOUD_PROJECT || serviceAccount?.project_id;
104+
process.env.GCLOUD_PROJECT || serviceAccount?.project_id; // eslint-disable-line camelcase
105105
if (!isString(projectId)) {
106106
const missingProjectIdErr =
107107
'Error GCLOUD_PROJECT environment variable or project_id from service account to initialize Firebase.';
@@ -219,7 +219,7 @@ export function slashPathToFirestoreRef(
219219
function deleteQueryBatch(
220220
db: any,
221221
query: admin.firestore.CollectionReference,
222-
resolve: Function,
222+
resolve: () => any,
223223
reject: any,
224224
): void {
225225
query

src/node-utils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/camelcase */
21
import { existsSync, readFileSync } from 'fs';
32

43
/**
@@ -97,6 +96,7 @@ function envVarBasedOnCIEnv(varNameRoot: string, envName?: string): any {
9796
return process.env[combined] || process.env[varNameRoot];
9897
}
9998

99+
/* eslint-disable camelcase */
100100
interface ServiceAccount {
101101
type: string;
102102
project_id: string;
@@ -109,6 +109,7 @@ interface ServiceAccount {
109109
auth_provider_x509_cert_url: string;
110110
client_x509_cert_url: string;
111111
}
112+
/* eslint-enable camelcase */
112113

113114
/**
114115
* Get service account from either local file or environment variables

src/plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { initializeFirebase } from './firebase-utils';
1111
* @returns Extended Cypress config
1212
*/
1313
export default function pluginWithTasks(
14-
cypressOnFunc: Function,
14+
cypressOnFunc: any,
1515
cypressConfig: any,
1616
adminInstance: any,
1717
): ExtendedCypressConfig {
@@ -21,7 +21,7 @@ export default function pluginWithTasks(
2121
}
2222
// Parse single argument from task into arguments for task methods while
2323
// also passing the admin instance
24-
const tasksWithFirebase: Record<string, Function> = {};
24+
const tasksWithFirebase: Record<string, (taskSettings: any) => any> = {};
2525
Object.keys(tasks).forEach((taskName) => {
2626
tasksWithFirebase[taskName] = (taskSettings: any): any => {
2727
if (taskSettings?.uid) {

src/tasks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function convertValueToTimestampIfPossible(
6868
function getDataWithTimestamps(
6969
data: admin.firestore.DocumentData,
7070
firestoreStatics: typeof admin.firestore,
71-
): object {
71+
): Record<string, any> {
7272
// Exit if no statics are passed
7373
if (!firestoreStatics) {
7474
return data;

0 commit comments

Comments
 (0)