You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would prefer import admin from 'firebase-admin' syntax instead of require('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:
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 import and require syntax, I'm not gonna do that for the sake of my sanity.
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: