firestore-jest-mock
firestore-jest-mock copied to clipboard
Requires wrong package for firebase 9
Description
I've tried to use mockFirebase, however it always logs "Module firebase not found, mocking skipped.".
The error comes from here:
https://github.com/Upstatement/firestore-jest-mock/blob/45f435c8b412f7bc9bc8e8d1fac797204e387efc/mocks/firebase.js#L41-L54
It tries to require.resolve('firebase'), however it seems like in Firebase 9 this is not possible anymore (I'm using e.g. require('firebase/firestore') so the mock should likely use similar imports).
Steps to reproduce
Create a project with firebase >= 9. Call mockFirebase().
See this repo for a minimal example: https://github.com/Otto-AA/firestore-mock-bug-demo
Expected result
It should mock firebase.
Actual result
It does not find the firebase module.
Environment
- Node version: v16.18.0
- [email protected]
- [email protected]
- [email protected]
Thanks for reporting! We'll have to add the new name spaces to the import checks
I'm using Firebase 9 and having a similar problem.
Any fix for this? I'm experiencing the same issue.
If you have the same problem, please simply upvote the issue. It's a bit annoying to receive emails for every "Same". Thank you!