【发布时间】:2019-11-15 18:46:04
【问题描述】:
我正在使用带有 image-resize-module 的 ngx-quill 并让它在我的应用程序中运行
import Quill from 'quill';
import ImageResize from 'quill-image-resize-module';
Quill.register('modules/imageResize', ImageResize);
export class MyComponent {
quillModules = {
imageResize: {},
toolbar: [
...
],
};
}
在我的 angular.json 中,我已将 quill.js 添加到构建和测试的脚本中
"scripts": [
"node_modules/quill/dist/quill.min.js",
]
我的测试文件正在导入 QuillModule
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
QuillModule,
...
],
但是,在我的茉莉花测试中,我收到了这个警告
'quill', 'Overwriting modules/imageResize with', function t(e){ ... }
还有这个错误
{
"message": "An error was thrown in afterAll\n[object ErrorEvent]",
"str": "An error was thrown in afterAll\n[object ErrorEvent]"
}
这打破了我的整个测试运行器,它只运行了大约 40 次测试,然后才抛出这个错误。 我把它缩小到在我的组件中注册 imageResize 模块
Quill.register('modules/imageResize', ImageResize);
如果我删除此行,我的测试将再次运行。
编辑
我找到了解决方法并添加了答案
【问题讨论】: