Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 73 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@
},
"homepage": "https://github.com/firebase/firebase-functions-test#readme",
"dependencies": {
"@types/cors": "^2.8.19",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The @types/cors package has been added as a production dependency. Typically, @types packages are only needed for development and should be placed in devDependencies, unless your library exposes types from the cors package in its public API. If that's not the case, please move this to devDependencies to avoid adding unnecessary dependencies for consumers of this package.

"@types/lodash": "^4.14.202",
"lodash": "^4.17.21",
"ts-deepmerge": "^8.0.0"
},
"devDependencies": {
"@types/chai": "~4.2.4",
"@types/express": "4.17.8",
"@types/express": "^5.0.6",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This version of @types/express (^5.0.6) is for Express 5, but firebase-functions@7.3.0 (which is also being updated in this PR) depends on Express 4 and its corresponding types (@types/express@^4.17.21). This version mismatch is the likely reason skipLibCheck: true was added to the tsconfig.json files, which is not ideal as it can hide other potential type issues.

To ensure type compatibility and allow for the removal of skipLibCheck, please align this dependency with what firebase-functions requires.

Suggested change
"@types/express": "^5.0.6",
"@types/express": "^4.17.21",

"@types/mocha": "^10.0.10",
"@types/node": "^18.19.130",
"@typescript-eslint/eslint-plugin": "^7.18.0",
Expand All @@ -53,7 +54,7 @@
"eslint": "^8.57.1",
"eslint-config-prettier": "^10.1.8",
"firebase-admin": "^12.0.0",
"firebase-functions": "^4.9.0",
"firebase-functions": "^7.3.0",
"firebase-tools": "^13.15.4",
"mocha": "^11.7.6",
"prettier": "^2.8.8",
Expand Down
52 changes: 27 additions & 25 deletions spec/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { expect } from 'chai';
import * as functions from 'firebase-functions/v1';
import { set } from 'lodash';

import { mockConfig, makeChange, wrap } from '../src/main';
import { makeChange, wrap } from '../src/main';
import { _makeResourceName, _extractParams } from '../src/v1';
import { features } from '../src/features';
import { FirebaseFunctionsTest } from '../src/lifecycle';
Expand Down Expand Up @@ -318,28 +318,30 @@ describe('main', () => {
});
});

describe('#mockConfig', () => {
let config: Record<string, unknown>;

beforeEach(() => {
config = { foo: { bar: 'faz ' } };
});

afterEach(() => {
delete process.env.CLOUD_RUNTIME_CONFIG;
});

it('should mock functions.config()', () => {
mockConfig(config);
expect(functions.config()).to.deep.equal(config);
});

it('should purge singleton config object when it is present', () => {
mockConfig(config);
config.foo = { baz: 'qux' };
mockConfig(config);

expect(functions.config()).to.deep.equal(config);
});
});
// functions.config() has been completely removed in firebase-functions v7.
// Since the latest version of the SDK no longer supports runtime config,
// this functionality can no longer be tested in modern SDKs.
// describe('#mockConfig', () => {
// let config: Record<string, unknown>;
//
// beforeEach(() => {
// config = { foo: { bar: 'faz ' } };
// });
//
// afterEach(() => {
// delete process.env.CLOUD_RUNTIME_CONFIG;
// });
//
// it('should mock functions.config()', () => {
// mockConfig(config);
// expect((functions as any).config()).to.deep.equal(config);
// });
//
// it('should purge singleton config object when it is present', () => {
// mockConfig(config);
// config.foo = { baz: 'qux' };
// mockConfig(config);
// expect((functions as any).config()).to.deep.equal(config);
// });
// });
});
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"outDir": ".tmp",
"sourceMap": true,
"target": "es6",
"typeRoots": ["node_modules/@types"]
"typeRoots": ["node_modules/@types"],
"skipLibCheck": true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This flag should be removed after fixing the @types/express version mismatch in package.json. Using skipLibCheck can hide important type-related issues in your dependencies.

},
"include": ["src/**/*.ts", "spec/**/*.ts"]
}
3 changes: 2 additions & 1 deletion tsconfig.release.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"outDir": "lib",
"stripInternal": true,
"target": "es6",
"typeRoots": ["node_modules/@types"]
"typeRoots": ["node_modules/@types"],
"skipLibCheck": true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This flag should be removed after fixing the @types/express version mismatch in package.json. Using skipLibCheck can hide important type-related issues in your dependencies.

},
"files": ["src/index.ts"]
}
Loading