I was set up the angular project with the jest unit testing framework and after running the test case it's throwing me an error.
TypeError: Cannot read property 'injector' of null
app.component.spec.ts
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('AppComponent', () => {
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;
beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [AppComponent],
imports: [HttpClientTestingModule],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it(`should have as title 'Angular-unitTest'`, () => {
expect(AppComponent).toBeTruthy();
});
});
Let me know if you need more information to figure out where is the problem.
Thanks