TestBed 配置(可选)

    tests.configure.ts创建测试平台(如果测试平台不存在),编译模板,然后导出configureTests,然后在我们的单元测试中导入和使用它。
    下面来看看如何使用它:

    1. import { TestBed } from '@angular/core/testing';
    2. import { ExampleComponent } from './index';
    3. import { configureTests } from '../../tests.configure';
    4. describe('Component: Example', () => {
    5. beforeEach(done => {
    6. const configure = (testBed: TestBed) => {
    7. testBed.configureTestingModule({
    8. });
    9. configureTests(configure).then(testBed => {
    10. fixture = testBed.createComponent(ExampleComponent);
    11. fixture.detectChanges();
    12. done();