Skip to content

Issue with upgrading to angularFire 6.0.2 in combination with jest and ng10 #2549

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

Closed
LanderBeeuwsaert opened this issue Jul 20, 2020 · 2 comments

Comments

@LanderBeeuwsaert
Copy link

angularFire 6.0.2
Angular 10.0.4
Angular cli: 10.0.3
firebase: 7.16.1

Other (e.g. Ionic/Cordova, Node, browser, operating system):
Tested with node 12, 13 and 14
OS: Windows

How to reproduce these conditions

So when upgrading from angularFire 6.0.0 to angularFire 6.0.2, the following jest unit test will start to fail. Nothing else is being touched, so I'm pretty sure it has something to do with the upgrade of angularFire.

Failing test unit
See also these issues when I thought it had something to do with jest:
thymikee/jest-preset-angular#421
jestjs/jest#10251 (comment)

This test will fail with jest:

'
import { async, TestBed } from '@angular/core/testing';

import { AngularFireModule } from '@angular/fire';

import { environment } from '../../../src/environments/environment';

import { Authentication } from '../../../src/app/core/services/authentication.service';

import { FirestoreService } from '../../../src/app/core/services/firestore-service';

import { MatDialogModule } from '@angular/material/dialog';

import { database } from 'firebase';

import { NO_ERRORS_SCHEMA } from '@angular/core';

import DataSnapshot = firebase.database.DataSnapshot;

 

describe('Test Dynamic Calculation', () => {

const resetTestingModule = TestBed.resetTestingModule,

preventAngularFromResetting = () => (TestBed.resetTestingModule = () => TestBed);

 

beforeAll(async(async () => {

resetTestingModule();

preventAngularFromResetting();

 

TestBed.configureTestingModule({

  imports: [

    AngularFireModule.initializeApp(environment.firebaseConfig),

    MatDialogModule,

  ],

  declarations: [

  ],

  providers: [

    FirestoreService,

    Authentication,

  ],

  schemas: [NO_ERRORS_SCHEMA],

});

await TestBed.compileComponents();

}));

 

afterAll(() => resetTestingModule());

 

beforeEach(async () => {

//we need to inject something it seems otherwise firebase complains the app has not been initialized

ed = TestBed.inject(FirestoreService);

 

let result: DataSnapshot = await database().ref('/data').once('value');

});

let ed: FirestoreService;

 

it('Example 0', () => {

 

});

});
'

Debug output

Error: Uncaught [TypeError: A dynamic import callback was not specified.] at reportException (C:\Users\Rubenn\AC\acro-companion\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:62:24) at Timeout.task [as _onTimeout] (C:\Users\Rubenn\AC\acro-companion\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\browser\Window.js:396:9) at listOnTimeout (internal/timers.js:551:17) at processTimers (internal/timers.js:494:7) TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified. at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:31:9) at C:\Users\Rubenn\AC\acro-companion\node_modules\src\auth\auth.ts:58:52 at ZoneDelegate.invoke (C:\Users\Rubenn\AC\acro-companion\node_modules\zone.js\dist\zone.js:386:30) at ProxyZoneSpec.onInvoke (C:\Users\Rubenn\AC\acro-companion\node_modules\zone.js\dist\proxy.js:117:43) at ZoneDelegate.invoke (C:\Users\Rubenn\AC\acro-companion\node_modules\zone.js\dist\zone.js:385:36) at Zone.run (C:\Users\Rubenn\AC\acro-companion\node_modules\zone.js\dist\zone.js:143:47) at NgZone.runOutsideAngular (C:\Users\Rubenn\AC\packages\core\src\zone\ng_zone.ts:227:50) at SwitchMapSubscriber.project (C:\Users\Rubenn\AC\acro-companion\node_modules\src\auth\auth.ts:58:28) at SwitchMapSubscriber._next (C:\Users\Rubenn\AC\acro-companion\node_modules\rxjs\src\internal\operators\switchMap.ts:123:21) at SwitchMapSubscriber.Subscriber.next (C:\Users\Rubenn\AC\acro-companion\node_modules\rxjs\src\internal\Subscriber.ts:99:12) { code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING' }

@LanderBeeuwsaert LanderBeeuwsaert changed the title Issue with upgrading to ng10 in combination with jest Issue with upgrading to angularFire 6.0.2 in combination with jest and ng10 Jul 20, 2020
@jamesdaniels
Copy link
Member

Closing as outdated for now. Do you still run into this if you upgrade everything?

@LanderBeeuwsaert
Copy link
Author

@jamesdaniels nope, all good, thanks!

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

2 participants