Angular2 RC4测试:Uncaught(承诺):TypeError:testing_1.expect(...)。toBeAnInstanceOf不是函数

时间:2016-07-13 08:20:09

标签: testing angular karma-jasmine

这是我在Angular2中的测试:

it('should initialize without DI service',
         async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
           var template = '<component></component>';
           return tcb.overrideTemplate(TestComponent, template)
               .createAsync(TestComponent)
               .then((fixture ) => {
                 expect(fixture.debugElement.children[0].componentInstance).toBeAnInstanceOf(ComponentType);
                 expect(fixture.debugElement.children[0].componentInstance.state).toBeNull();
               });
         })));

它会抛出以下错误:

  

未捕获(承诺):TypeError:   testing_1.expect(...)。toBeAnInstanceOf不是函数

它在Angular2 RC2中工作正常,直到我更新到RC4。

1 个答案:

答案 0 :(得分:0)

由于很长一段时间没有得到答复,这篇文章可能对未来有所帮助:

Uncaught TypeError: ctorParameters.map is not a function