我有一个测试文件夹,其中有 3 个文件,
1)nav-bar.init.spec.ts
2)nav-bar.scaffold.ts
3)nav-bar.spec.ts
我分别有以下代码,
在 nav-bar.init.spec.ts 中,
import { TestBed, async } from '@angular/core/testing';
import { Navbarcomponent } from './app.component';
describe('Navbarcomponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
Navbarcomponent
],
}).compileComponents();
}));
在 nav-bar.spec.ts 中,
import { TestBed, async } from'@angular/core/testing';
import { Navbarcomponent } from './app.component';
describe('Navbarcomponent', () => {
let component: Navbarcomponent;
beforeEach(() => {
component = new Navbarcomponent();
}));
it (should create,()=>{
expect(conponent).toBeTruthy()
}); //// I added this test case here
当我运行测试用例时,业力屏幕显示“NO SPEC FOUND”
我的 Karma.config 文件, karma-config-1
[karma-config-2][2]
我对这种模块化感到困惑。任何人都可以请建议我帮助。谢谢。