角形“路由器出口”不是已知元素

时间:2018-08-28 08:24:56

标签: angular unit-testing testing

我正在尝试测试我的应用,但添加路由后无法执行。现在,我有该测试

describe('AppComponent', () => {
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        RouterTestingModule
      ],
      declarations: [
        AppComponent,
        NavbarComponent,
        IndexComponent,
        ProjectsComponent,
        BioComponent,
        SiteComponent,
        SiteItemComponent
      ],
    }).compileComponents();
  }));
  it('should create the app', async(() => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));
});

在每个地方都写着值得添加RouterTestingModule,但是它是从Angular CLI生成开始就添加的。

0 个答案:

没有答案