Angular 2 Jasmine testing, Loading all components in app.component.ts?

后端 未结 2 1441
深忆病人
深忆病人 2021-01-16 01:01

I\'m working on a small test app to learn Angular 2 and unit testing in Angular 2 a bit better. Coming from a react - Jest background; it feels weird to include all componen

2条回答
  •  死守一世寂寞
    2021-01-16 01:28

    If you have a few components grouped in one module you can import module to test instead of declaring each component.

    beforeEach(async(() => {
      TestBed.configureTestingModule({
        declarations: [AppComponent],
        imports: [SomeModule]
      }).compileComponents();
    }));
    

提交回复
热议问题