Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在angular中使用jest mock模拟导入依赖项(ckeditor)_Angular_Unit Testing_Jestjs_Ckeditor - Fatal编程技术网

如何在angular中使用jest mock模拟导入依赖项(ckeditor)

如何在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', () =>

我需要在测试中导入CKEditorModule(如果我直接导入jest无法解析),如何使用jest.mock模拟它

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模式

如果它仍然验证角度模式,您是否找到了解决方案?(而不是跳过验证)如果你改进这个问题的措辞,我会投赞成票。我面对的是同一个问题,但问题本身没有任何意义,除非你面对的是同一个问题。例如,描述错误等。