-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase-admin 10.0.0 modular imports: Cannot find module 'firebase-admin/app' from 'functions/src/index.ts' #1481
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
ESLint is also having problems: |
Experiencing the same problem here: "firebase-admin": "10.0.0",
"@types/jest": "27.0.2",
"jest": "27.3.1"
"ts-jest": "27.0.7"
"typescript": "4.4.4"
{
"compilerOptions": {
"lib": [
"es2020"
],
"module": "commonjs",
"target": "es2020",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./lib"
},
"files": [
// REDACTED
],
"include": [
"src"
],
"exclude": [
"**/__mocks__"
]
} |
Issue with Jest is a known limitation in Jest's module resolver. See #1465 for more details including a link to the original bug report on the Jest project, and some workarounds. Good news is there's a good chance Jest might fix this issue in their next major version. Issue with ESLint is a similar known problem with the corresponding tool. See #1359. You will most likely have to implement the workaround mentioned in that thread. |
[READ] Step 1: Are you in the right place?
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
After the migration to the new firebase-admin 10.0.0 and the new modular sdk imports, deploying the functions and running them works great.
However, when unit testing them, jest doesn't find the module packages and gives this as output:
FAIL spec/tests/app/functions/util-helpers.spec.ts
● Test suite failed to run
PASS spec/tests/app/import-service/validators/inbetween-integer.validator.spec.ts
FAIL spec/tests/app/scoring/team-ranking.service.spec.ts
● Test suite failed to run
PASS spec/tests/app/import-service/validators/email.validator.spec.ts
FAIL spec/tests/app/generic-competitions/generic-acro-ranking.service.spec.ts
● Test suite failed to run
PASS spec/tests/app/import-service/validators/positive-integer.validator.spec.ts
FAIL spec/tests/app/scoring/acro-specific-ranking.service.spec.ts
● Test suite failed to run
PASS spec/tests/app/import-service/validators/firestore-key.validator.spec.ts
PASS spec/tests/app/import-service/validators/length.validator.spec.ts
PASS spec/tests/app/import-service/validators/split-and-apply-multiple-validators.spec.ts
PASS spec/tests/app/helpers.service.spec.ts
PASS spec/tests/app/trampoline/judges-trampoline-service.spec.ts
PASS spec/tests/app/generic-competition-admin/exercises-import.spec.ts
● Console
Summary of all failing tests
FAIL spec/tests/app/functions/util-helpers.spec.ts
● Test suite failed to run
FAIL spec/tests/app/scoring/team-ranking.service.spec.ts
● Test suite failed to run
FAIL spec/tests/app/generic-competitions/generic-acro-ranking.service.spec.ts
● Test suite failed to run
FAIL spec/tests/app/scoring/acro-specific-ranking.service.spec.ts
● Test suite failed to run
The text was updated successfully, but these errors were encountered: