TestBed 配置(可选)
tests.configure.ts
创建测试平台(如果测试平台不存在),编译模板,然后导出configureTests,
然后在我们的单元测试中导入和使用它。
下面来看看如何使用它:
import { TestBed } from '@angular/core/testing';
import { ExampleComponent } from './index';
import { configureTests } from '../../tests.configure';
describe('Component: Example', () => {
beforeEach(done => {
const configure = (testBed: TestBed) => {
testBed.configureTestingModule({
});
configureTests(configure).then(testBed => {
fixture = testBed.createComponent(ExampleComponent);
fixture.detectChanges();
done();