Closed oleh-kazban-gl closed 3 months ago
quilljs is released as esm and with jest it could be a little bit hard to get things working.
But you can try to use something like this in your jest.config
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)', 'node_modules/quill/*'],
or you could create a default mock for quill module that is loaded in each test, or mock it manually by using jest.mock('quill', () => ({ ... }))
PS: Same question at quilljs repo: https://github.com/slab/quill/issues/4338
Hello there,
I got the same issue and it does not seem to work even with
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)', 'node_modules/quill/*']
Any idea why ?
jest.mock('quill', () => ({ ... }))
works fine, thanks
transformIgnorePatterns: ['node_modules/(?!quill)']
should do the trick. By default jest/babel-jest ignores files in node_module but we need to enable it for esm packages.
transformIgnorePatterns: ['node_modules/(?!quill)']
should do the trick. By default jest/babel-jest ignores files in node_module but we need to enable it for esm packages.
@luin not working on my side
Then just mock the module ;-) or the whole quill-editor component
Am 30. Juli 2024 17:21:01 MESZ schrieb Alexandre Robin @.***>:
transformIgnorePatterns: ['node_modules/(?!quill)']
should do the trick. By default jest/babel-jest ignores files in node_module but we need to enable it for esm packages.@luin not working on my side
-- Reply to this email directly or view it on GitHub: https://github.com/KillerCodeMonkey/ngx-quill/issues/1907#issuecomment-2258614026 You are receiving this because you commented.
Message ID: @.***>
The problem is actually in quill
itself rather than ngx-quill
so there's not much we can do about it here.
See https://github.com/slab/quill/issues/4338
In particular, this workaround seemed to fix it for us.
Hi there. Trying to use your module in my project (Angular 18, Nx, Jest etc), everything is working but I can't create unit tests because they fail everywhere I try to use my component that utilizes ngx-quill.
So, the problem is like this: ` Test suite failed to run
`
Tried to dug the proposed links: