I'm trying to use a simple test on Angular, here is the content of the test :
import { ComponentFixture } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing'; import { By } from "@angular/platform-browser" import { TestComponentComponent } from './test-component.component'; fdescribe('TestComponentComponent', () => { let component: TestComponentComponent; let fixture: ComponentFixture<TestComponentComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [ TestComponentComponent ] }) .compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(TestComponentComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should show no data', () => { fixture.detectChanges(); const noDataDiv = fixture.debugElement.query(By.css('#noData')); expect(noDataDiv.nativeElement.textContent).toEqual('No Data'); }); }); i run the test by this command :
ng test --main .\src\app\test-component\test-component.component.spec.ts
and i got this error :
TypeError: Cannot read property 'ngModule' of null
is there any change between the version ?
i'm using the latest version of angular and the test file has been generated with command ng generate component
i've just add the 'f' behind the describe and the latest 'it'