-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error testing vue component that uses ckeditor5-vue #128
Comments
Hi! Thanks for the report, unfortunately I can confirm this. When running tests using vue-test-utils & Jest I get the same error: import Editor from '@ckeditor/ckeditor5-core/src/editor/editor';
^^^^^^
SyntaxError: Unexpected identifier
7 | <script>
8 | import CKEditor from "@ckeditor/ckeditor5-vue";
> 9 | import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
| ^
10 | import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
11 | import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
12 | import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at src/components/CKEditor.vue:9:1
at Object.<anonymous> (src/components/CKEditor.vue:57:3) Mentioned previously here: #50 (comment) cc @oleq |
Is there a way to resolve this?? |
I'm closing this due to lack of activity. |
Still not solved =/ same problem here |
Finally got this working, although I'm not sure what did the trick. What I did:
transformIgnorePatterns: [
'/node_modules/(?!lodash-es)(?!@ckeditor/*)(?!ckeditor5/*)', // transform all ckeditor dependencies
'\\.pnp\\.[^\\/]+$'
],
moduleNameMapper: {
// Don't add 'svg' here...
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.ts',
// instead only add entry for svgs which are part of your project
// adjust to fit your svg paths
'(assets\\/svg\\/.*\\.svg)$': '<rootDir>/__mocks__/fileMock.ts'
}, |
Still not working |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi all,
I have a vue project where I am using vue-test-utils and Jest for unit testing. While trying to run test on my component that has ckEditor5, I get the following error originating from \node_modules@ckeditor\ckeditor5-editor-classic\src\classiceditor.js:10
I followed the documentation for configuring vue.config.js. Is there some sort of configuration required for jest.config.js as well?
Please help
This is how I am using the editor:
In main.js
I created a mixin (like below) that I import in my component:
The text was updated successfully, but these errors were encountered: