Skip to content
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

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

Open
slaweet opened this issue Nov 16, 2020 · 1 comment
Open

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

slaweet opened this issue Nov 16, 2020 · 1 comment

Comments

@slaweet
Copy link

slaweet commented Nov 16, 2020

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.

@p-kuen
Copy link
Contributor

p-kuen commented Dec 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants