角色中的业力测试在组件中不起作用

时间:2017-09-26 07:26:43

标签: angular karma-jasmine

当我运行一些业力测试,并在tutorial中创建1st.spec.ts时,它没有任何问题。但是当我尝试创建一个xxxx.component.spec.ts时,没有任何测试运行,甚至1st.spec.ts都不会运行。

编辑: 我系统地调试以查明问题:

beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [ LoginComponent ], // declare the test component
    });


  });

1 个答案:

答案 0 :(得分:0)

虽然不是最好的方法,但这仍然可以解决您的问题。

此解决方案是您正在关注https://angular.io/generated/live-examples/testing/1st-specs.eplnkr.html

的教程

将所有测试规范添加到__spec_files__

中的index.html数组中
var __spec_files__ = [
      'app/1st.spec', 'app/xxx.spec', 'app/yyy.spec'
    ];

我为上述说明创建了plunker