Angular - Importing O which does not have a ɵmod property

Viewed 14

I am configuring jest for my Angular application.

I put all imports and providers in two seperate arrays and then imported the arrays as follows. Then I provide these arrays as the respective providers and imports for TestBed.

import { imports } from 'app.imports';
import { providers } from 'app.providers';

beforeEach(() => {
TestBed.configureTestingModule({
  declarations: [ SamplePage ],
  imports: imports,
  providers: providers
}).compileComponents();

I have several test files which give the following error on running npm test

FAIL  src/app/modules/sample/sample.page.spec.ts
● SamplePage › should create

Importing O which does not have a ɵmod property

  11 |
  12 |   beforeEach(() => {
> 13 |     TestBed.configureTestingModule({
     |             ^
  14 |       declarations: [ SamplePage ],
  15 |       imports: imports,
  16 |       providers: providers

  at node_modules/@angular/core/fesm2020/core.mjs:24112:19
      at Array.forEach (<anonymous>)
  at transitiveScopesFor (node_modules/@angular/core/fesm2020/core.mjs:24109:32)
  at setScopeOnDeclaredComponents (node_modules/@angular/core/fesm2020/core.mjs:24051:30)
  at flushModuleScopingQueueAsMuchAsPossible (node_modules/@angular/core/fesm2020/core.mjs:23737:21)
  at TestBedRender3.checkGlobalCompilationFinished (node_modules/@angular/core/fesm2020/testing.mjs:1820:13)
  at TestBedRender3.configureTestingModule (node_modules/@angular/core/fesm2020/testing.mjs:1703:14)
  at Function.configureTestingModule (node_modules/@angular/core/fesm2020/testing.mjs:1562:30)
  at src/app/modules/sample/sample.page.spec.ts:13:13
  at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
  at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
  at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
  at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
  at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4330:34)
0 Answers
Related