vue-markdown-render
vue-markdown-render copied to clipboard
Compatibility with @vue/cli-plugin-unit-jest
When I'm testing my component with https://cli.vuejs.org/core-plugins/unit-jest.html and my component contains import VueMarkdown from 'vue-markdown-render';, then the Jest test runner fails with:
● Test suite failed to run
--
44 |
45 | /drone/src/node_modules/vue-markdown-render/dist/VueMarkdown.js:1
46 | ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Vue from "vue";
47 | ^^^^^^
48 |
49 | SyntaxError: Cannot use import statement outside a module
I can resolve the error by mocking vue-markdown-render with
jest.mock('vue-markdown-render', () => (
(fn: (...args: any[]) => void) => fn
));
But with all other 3-rd party modules, I don't have to do this.
Thanks for posting this issue. This is likely happening because of using ES modules for compiling TS. I will have a look at this soon.
This shouldn't be a problem anymore with the latest version of vue-markdown-render.