vue-markdown-render icon indicating copy to clipboard operation
vue-markdown-render copied to clipboard

Compatibility with @vue/cli-plugin-unit-jest

Open slaweet opened this issue 5 years ago • 1 comments

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.

slaweet avatar Nov 16 '20 16:11 slaweet

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.

p-kuen avatar Dec 03 '20 07:12 p-kuen

This shouldn't be a problem anymore with the latest version of vue-markdown-render.

p-kuen avatar May 24 '24 04:05 p-kuen