小编P.P*_*kov的帖子

在Angular 2 RC5之后,测试失败了

我使用以下格式进行测试:

export function main() {
    describe('Angular2 component test', function() {
         it('should initialize component',
           async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
              var template = '<specific-component-tag>';
                return tcb.overrideTemplate(TestComponent, template)
                .createAsync(TestComponent)
                .then((fixture) => {
                    expect(fixture.componentInstance.viewChild).toBeDefined();
                    fixture.detectChanges();
                    expect(fixture.componentInstance.viewChild.items.length).toBe(1);
                    // .... etc.
                }).catch (reason => {
                    console.log(reason);
                    return Promise.reject(reason);
                });
         })));
      });
}
Run Code Online (Sandbox Code Playgroud)
这在RC4中工作正常.但RC5突然来了,现在这段代码没有用.它引发了以下错误:

Module ".... @angular/core/testing" has no exported member 'it'.
Module ".... @angular/core/testing" has no exported member 'describe'.
Module ".... @angular/core/testing" has no exported member 'expect'.
Module ".... @angular/core/testing" has no exported member 'beforeEachProviders'.
Module …
Run Code Online (Sandbox Code Playgroud)

migration testing angular

12
推荐指数
1
解决办法
5155
查看次数

标签 统计

angular ×1

migration ×1

testing ×1