Soy nuevo con la prueba unitaria de angular y estoy usando jest, lo instalo con ng add @briebug/jest-schematic. Cuando ejecuta la prueba npm (broma) en un proyecto base, arroja el siguiente error
FAIL src/app/app.component.spec.ts (7.418 s) AppComponent ✕ should create the app (6 ms) ● AppComponent › should create the app zone-testing.js is needed for the fakeAsync() test helper but could not be found. Please make sure that your environment includes zone.js/testing at resetFakeAsyncZone (../packages/core/testing/src/fake_async.ts:25:9) at Object.<anonymous> (../packages/core/testing/src/test_hooks.ts:39:7) at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13) at runJest (node_modules/@jest/core/build/runJest.js:387:19) at _run10000 (node_modules/@jest/core/build/cli/index.js:408:7) at runCLI (node_modules/@jest/core/build/cli/index.js:261:3) Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: 9.579 sCómo resolver este problema, gracias y aquí está el componente de la aplicación.
import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ RouterTestingModule ], declarations: [ AppComponent ], }).compileComponents(); }); it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.componentInstance; expect(app).toBeTruthy(); }); });