Skip to content

Upgrade to 9.2.0 gives error in jest unit tests #5687

Closed
@LanderBeeuwsaert

Description

@LanderBeeuwsaert

[REQUIRED] Describe your environment

  • Operating System version: Windows 10
  • Browser version: ---
  • Firebase SDK version: 9.1.3 upgrade to 9.2.0
  • Firebase Product: ----

[REQUIRED] Describe the problem

When upgrading to firebase 9.2.0 from 9.1.3 our jest unit tests start to fail with the following message:

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

We do use AngularFire (7.1.1) as well.
Running our Angular application itself seems to be ok. So it seems to be related with the upgrade + our jest configuration maybe?

Adding the full test log below:

PASS spec/tests/app/import-service/validators/country.validator.spec.ts
PASS spec/tests/app/patchers/organisation/1_0.patcher.spec.ts
PASS spec/tests/app/import-service/validators/firestore-doc.validator.spec.ts
PASS spec/tests/app/functions/country-service-backend.spec.ts
PASS spec/tests/app/scoring/calculate-partial-score.spec.ts
PASS spec/tests/app/import-service/validators/unique-column-value.validator.spec.ts
PASS spec/tests/app/version-patcher-service.spec.ts
PASS spec/tests/app/import-service/validators/column-exclusive-required.validator.spec.ts
PASS spec/tests/app/import-service/validators/array-match.validator.spec.ts
PASS spec/tests/app/import-service/validators/vat.validator.spec.ts
PASS spec/tests/app/import-service/validators/positive-integer.validator.spec.ts
PASS spec/tests/app/import-service/validators/inbetween-integer.validator.spec.ts
PASS spec/tests/app/import-service/validators/length.validator.spec.ts
PASS spec/tests/app/import-service/validators/firestore-key.validator.spec.ts
PASS spec/tests/app/import-service/validators/trimmed.validator.spec.ts
PASS spec/tests/app/import-service/validators/email.validator.spec.ts
PASS spec/tests/app/import-service/validators/split-and-apply-multiple-validators.spec.ts
PASS spec/tests/app/import-service/import.service.spec.ts
FAIL spec/tests/app/generic-competition-admin/exercises-import.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

FAIL spec/tests/app/helpers.service.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

FAIL spec/tests/app/trampoline/judges-trampoline-service.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

PASS spec/tests/app/functions/util-helpers.spec.ts
● Console

console.warn {"severity":"WARNING","message":"Warning, FIREBASE_CONFIG and GCLOUD_PROJECT environment variables are missing. Initializing firebase-admin will fail" 

}

 at write (functions/node_modules/firebase-functions/lib/logger/index.js:44:78) at warn (functions/node_modules/firebase-functions/lib/logger/index.js:95:5) at setup (functions/node_modules/firebase-functions/lib/setup.js:56:31) at Object.<anonymous> (functions/node_modules/firebase-functions/lib/index.js:67:19) 

PASS spec/tests/app/scoring/acro-specific-ranking.service.spec.ts
● Console

console.warn {"severity":"WARNING","message":"Warning, FIREBASE_CONFIG and GCLOUD_PROJECT environment variables are missing. Initializing firebase-admin will fail" 

}

 at write (functions/node_modules/firebase-functions/lib/logger/index.js:44:78) at warn (functions/node_modules/firebase-functions/lib/logger/index.js:95:5) at setup (functions/node_modules/firebase-functions/lib/setup.js:56:31) at Object.<anonymous> (functions/node_modules/firebase-functions/lib/index.js:67:19) 

PASS spec/tests/app/generic-competitions/generic-acro-ranking.service.spec.ts
● Console

console.warn {"severity":"WARNING","message":"Warning, FIREBASE_CONFIG and GCLOUD_PROJECT environment variables are missing. Initializing firebase-admin will fail" 

}

 at write (functions/node_modules/firebase-functions/lib/logger/index.js:44:78) at warn (functions/node_modules/firebase-functions/lib/logger/index.js:95:5) at setup (functions/node_modules/firebase-functions/lib/setup.js:56:31) at Object.<anonymous> (functions/node_modules/firebase-functions/lib/index.js:67:19) 

FAIL spec/tests/app/scoring/team-ranking.service.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

Summary of all failing tests
FAIL spec/tests/app/generic-competition-admin/exercises-import.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

FAIL spec/tests/app/helpers.service.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

FAIL spec/tests/app/trampoline/judges-trampoline-service.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

FAIL spec/tests/app/scoring/team-ranking.service.spec.ts
● Test suite failed to run

TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.node.cjs.js' at Function.createRequire (node_modules/jest-runtime/build/index.js:1418:23) at Object.<anonymous> (node_modules/@firebase/firestore/src/platform/node/grpc_connection.ts:43:24) at Object.<anonymous> (node_modules/@firebase/firestore-compat/dist/index.node.cjs.js:6:17) 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close