During my unit test i see this error
Error: e does not have a module def (ɵmod property)
I updated to angular v14(
"@angular/cli": "~14.0.0",
) and nx workspace (
"@nrwl/workspace": "14.4.3",
)
The error does not specify which module is causing the problem:
Error: e does not have a module def (ɵmod property)
at transitiveScopesFor(....)
test File:
describe('AppComponent', () => {
let mockOAuthService;
beforeEach(waitForAsync(() => {
// mocks
Object.defineProperty(window, 'matchMedia', {
value: jest.fn(() => {
return { matches: true };
}),
});
mockOAuthService = { logout: jest.fn(), checkAuthentication: () => Promise.resolve(null) };
TestBed.configureTestingModule({
declarations: [AppComponent, AddEntriesButtonComponent],
imports: [
BrowserAnimationsModule,
HttpClientModule,
HsMaterialModule,
RouterTestingModule,
RightsModule,
AuthModule.forRoot(),
NgxsModule.forRoot(),
],
providers: [{ provide: AuthService, useValue: mockOAuthService }, MediaObserver],
teardown: { destroyAfterEach: false },
}).compileComponents();
}));
it('should create the app successfully', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
});
I have been stuck with this for days and i cannot find solution anywhere. I have tried deleting node_module and npm ci and other steps in : https://github.com/storybookjs/storybook/issues/13958
It did not help.
I already have this in package json
"scripts": {
"postinstall": "ngcc --properties es2020 browser module main && node ./decorate-angular-cli.js",
}
as stated in ngx-leaflet-draw: Importing module which does not have a ɵmod property