Jest + AngularFire doesn't work #2691
LanderBeeuwsaert
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version info
AngularFire 6.1.1
Firebase 8.1.1
Angular 11.0.1
Jest 26.6.3
I'm also referencing this issue, that is the predecessor:
#2549
failing unit test
Running this unit test:
`
import { TestBed } from '@angular/core/testing';
import { AngularFireModule } from '@angular/fire';
import { environment } from '../../../src/environments/environment';
import { AngularFireAuth, AngularFireAuthModule } from '@angular/fire/auth';
let normalUserEmail: string = 'some@test.email.com';
let normalUserPass: string = 'some_password';
describe.only('Test', () => {
beforeEach(async () => {
TestBed.configureTestingModule({
imports: [AngularFireModule.initializeApp(environment.firebaseConfig), AngularFireAuthModule],
});
await TestBed.compileComponents();
});
it('Example 1', async (done) => {
console.log('before crash');
let angularFireAuth = TestBed.inject(AngularFireAuth);
console.log('after crash');
await angularFireAuth.signInWithEmailAndPassword(normalUserEmail, normalUserPass);
done();
});
});
`
logging
Will create this error:
`
TypeError: _vm(...).SyntheticModule is not a constructor
console.log
before crash
console.log
after crash
console.error
Unhandled Promise rejection: TypeError: _vm(...).SyntheticModule is not a constructor
at Runtime.loadCjsAsEsm (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:657:20)
at Runtime.linkModules (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:619:17)
at importModuleDynamically (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:1363:23)
at importModuleDynamicallyWrapper (internal/vm/module.js:432:21)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:37:14)
at C:\Lander\WS\acro-companion\node_modules\src\auth\auth.ts:83:52
at ZoneDelegate.Object..ZoneDelegate.invoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing
-bundle.umd.js:402:30)
at ProxyZoneSpec.Object..ProxyZoneSpec.onInvoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-tes
ting-bundle.umd.js:3746:43)
at ZoneDelegate.Object..ZoneDelegate.invoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing
-bundle.umd.js:401:56)
at Zone.Object..Zone.run (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing-bundle.umd.js:162:
47) ; Zone: ProxyZone ; Task: Promise.then ; Value: TypeError: _vm(...).SyntheticModule is not a constructor
at Runtime.loadCjsAsEsm (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:657:20)
at Runtime.linkModules (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:619:17)
at importModuleDynamically (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:1363:23)
at importModuleDynamicallyWrapper (internal/vm/module.js:432:21)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:37:14)
at C:\Lander\WS\acro-companion\node_modules\src\auth\auth.ts:83:52
at ZoneDelegate.Object..ZoneDelegate.invoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing
-bundle.umd.js:402:30)
at ProxyZoneSpec.Object..ProxyZoneSpec.onInvoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-tes
ting-bundle.umd.js:3746:43)
at ZoneDelegate.Object..ZoneDelegate.invoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing
-bundle.umd.js:401:56)
at Zone.Object..Zone.run (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing-bundle.umd.js:162:
47) undefined
console.error
Error: Uncaught [TypeError: _vm(...).SyntheticModule is not a constructor]
at reportException (C:\Lander\WS\acro-companion\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\living\helpe
rs\runtime-script-errors.js:62:24)
at Timeout.task [as _onTimeout] (C:\Lander\WS\acro-companion\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom
\browser\Window.js:396:9)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) TypeError: _vm(...).SyntheticModule is not a constructor
at Runtime.loadCjsAsEsm (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:657:20)
at Runtime.linkModules (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:619:17)
at importModuleDynamically (C:\Lander\WS\acro-companion\node_modules\jest-runtime\build\index.js:1363:23)
at importModuleDynamicallyWrapper (internal/vm/module.js:432:21)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:37:14)
at C:\Lander\WS\acro-companion\node_modules\src\auth\auth.ts:83:52
at ZoneDelegate.Object..ZoneDelegate.invoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing
-bundle.umd.js:402:30)
at ProxyZoneSpec.Object..ProxyZoneSpec.onInvoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-tes
ting-bundle.umd.js:3746:43)
at ZoneDelegate.Object..ZoneDelegate.invoke (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing
-bundle.umd.js:401:56)
at Zone.Object..Zone.run (C:\Lander\WS\acro-companion\node_modules\zone.js\bundles\zone-testing-bundle.umd.js:162:
47)
`
Expected behavior
That the test would not crash
Actual behavior
the test crashes
Beta Was this translation helpful? Give feedback.
All reactions