如何在angular中使用jest mock模拟导入依赖项(ckeditor)
我需要在测试中导入CKEditorModule(如果我直接导入jest无法解析),如何使用jest.mock模拟它如何在angular中使用jest mock模拟导入依赖项(ckeditor),angular,unit-testing,jestjs,ckeditor,Angular,Unit Testing,Jestjs,Ckeditor,我需要在测试中导入CKEditorModule(如果我直接导入jest无法解析),如何使用jest.mock模拟它 import { ComponentFixture, TestBed } from '@angular/core/testing'; import { myComponent } from './myComponent'; import { FormsModule } from '@angular/forms'; describe('myComponent', () =>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { myComponent } from './myComponent';
import { FormsModule } from '@angular/forms';
describe('myComponent', () => {
let component: myComponent;
let fixture: ComponentFixture<myComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [myComponent],
imports: [FormsModule]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(myComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
从'@angular/core/testing'导入{ComponentFixture,TestBed};
从“/myComponent”导入{myComponent};
从'@angular/forms'导入{FormsModule};
描述('myComponent',()=>{
let组分:myComponent;
let夹具:组件夹具;
beforeach(异步()=>{
等待TestBed.configureTestingModule({
声明:[myComponent],
导入:[FormsModule]
})
.compileComponents();
});
在每个之前(()=>{
fixture=TestBed.createComponent(myComponent);
组件=fixture.componentInstance;
fixture.detectChanges();
});
它('应该创建',()=>{
expect(component.toBeTruthy();
});
});
好的。忽略它,没有任何错误\u模式如果它仍然验证角度模式,您是否找到了解决方案?(而不是跳过验证)如果你改进这个问题的措辞,我会投赞成票。我面对的是同一个问题,但问题本身没有任何意义,除非你面对的是同一个问题。例如,描述错误等。