I am writing a spec.ts file in angular and getting the following error:
Failed: Illegal state: Could not load the summary for directive AppComponent.
Below is the code I tried
import { TestBed, async } from "@angular/core/testing";
import { AppComponent } from "./app.component";
describe('AppComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
});
});
});
it('should create the app', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));``
It seems that you're using a component which includes another components inside. You have to add all the components that you used in AppComponent in declaration of configureTestingModule
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With