Angular Karma Jasmine Error: Illegal state: Could not load the summary for directive

后端 未结 7 598
温柔的废话
温柔的废话 2021-02-03 16:47

I\'m developing a github repository (with angular 7 and angular-cli), and I have some tests with Karma and Jasmine working in the master branch.

Now I\'m trying to add l

7条回答
  •  天命终不由人
    2021-02-03 17:09

    For those who are still having issues with this - I read a separate github issue that discussed changes the Angular team made to the beforeEach callback function.

    Here is what I did:

    beforeAll(async(() => {
        TestBed.configureTestingModule({
            declarations: [BannerNotificationComponent]
        }).compileComponents()
    
        fixture = TestBed.createComponent(BannerNotificationComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    }));
    

    Using beforeAll fixes the issue. Hope this helps others as it took me about a day to get this resolve this obscure bug.

提交回复
热议问题