Skip to content
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

Requires wrong package for firebase 9 #158

Open
Otto-AA opened this issue Jan 11, 2023 · 4 comments
Open

Requires wrong package for firebase 9 #158

Otto-AA opened this issue Jan 11, 2023 · 4 comments

Comments

@Otto-AA
Copy link

Otto-AA commented Jan 11, 2023

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

@sbatson5
Copy link
Owner

Thanks for reporting! We'll have to add the new name spaces to the import checks

@thachp
Copy link

thachp commented Jan 26, 2023

I'm using Firebase 9 and having a similar problem.

@ChaseIndustries
Copy link

Any fix for this? I'm experiencing the same issue.

@Otto-AA
Copy link
Author

Otto-AA commented Apr 23, 2023

If you have the same problem, please simply upvote the issue. It's a bit annoying to receive emails for every "Same". Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants