Replies: 1 comment
-
|
This error comes from Jest not knowing how to handle Firebase Admin SDK v10+'s modular package exports ( Fix for Jest + NestJS (or any Node project)Add // jest.config.js
module.exports = {
// ... your existing config
moduleNameMapper: {
'^firebase-admin/app$': '<rootDir>/node_modules/firebase-admin/lib/app/index.js',
'^firebase-admin/auth$': '<rootDir>/node_modules/firebase-admin/lib/auth/index.js',
'^firebase-admin/firestore$': '<rootDir>/node_modules/firebase-admin/lib/firestore/index.js',
'^firebase-admin/messaging$': '<rootDir>/node_modules/firebase-admin/lib/messaging/index.js',
'^firebase-admin/storage$': '<rootDir>/node_modules/firebase-admin/lib/storage/index.js',
// Add other subpackages as needed
},
};Alternative: use
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When using Node.js SDK Admin SDK v10 in Nest.js, the test gets angry that the module is not found
Beta Was this translation helpful? Give feedback.
All reactions