【发布时间】:2020-04-30 05:46:31
【问题描述】:
第一次使用 Jest。使用以下代码初始化组件测试:
describe('CreateComponent', () => {
let component: CreateQuoteComponent;
let fixture: ComponentFixture<CreateQuoteComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateQuoteComponent ]
});
fixture = TestBed.createComponent(CreateQuoteComponent);
component = fixture.componentInstance;
}));
test('should exist', () => {
expect(component).toBeDefined();
});
});
运行时,对于组件中的一些imports给出了
Test suite failed to run Cannot find module' with '
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
at Object.<anonymous> (src/app/modules/xxx/components/landing/create/create.component.ts:19:1)
这方面的任何线索或是否有已知的解决方法?
【问题讨论】: