-
Notifications
You must be signed in to change notification settings - Fork 58
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
include firebase/admin with 'import' instead of 'require' #144
Comments
Any updates on this? Can't get the package to work with the |
I'm having the same issue. I use node js with typescript and tests are failing as it's not able to mock firebase-admin with the modern syntax. |
Grateful to have found this issue and know that I'm not the only one who was pulling their head out over this. Library is pretty perfect except for this fundamental limitation and while my code will technically run if I mix |
Bumping to see if I could get a review for #167 |
Summary
Would prefer
import admin from 'firebase-admin'
syntax instead ofrequire('firebase-admin')
Relevant information
Including sdk with
require('firebase-admin')
syntax seems mandatory (regarding docs, sample and my own experience) to make firestore mock work.Otherwise, the firestore mock is not initialised properly and the tests crash at the first collection call.
As moderns Typescript coders, my team and I would prefer a proper
import admin from 'firebase-admin')
style of include.Is there a way to initialize the test, mocks etc properly without that ugly
require
thing ?Even adding a
jest.mock(admin.firestore...)
or something would be more acceptable to us.You guys did a great job, by the way ;-)
Environment (if relevant)
I can provide test sample if needed, but i gess my question is quite self explanatory.
The text was updated successfully, but these errors were encountered: