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

SyntaxError: Unexpected token import when using in Jest tests #52

Open
artemv opened this issue Jul 4, 2018 · 0 comments
Open

SyntaxError: Unexpected token import when using in Jest tests #52

artemv opened this issue Jul 4, 2018 · 0 comments

Comments

@artemv
Copy link

artemv commented Jul 4, 2018

If vue-masked-input is used inside a component tested by Jest I get following error:

 FAIL  test/unit/specs/PhoneEntry.spec.js
  ● Test suite failed to run

    /Users/artem/my-project/node_modules/vue-masked-input/dist/maskedInput.js:3
    import InputMask from 'inputmask-core';
    ^^^^^^

    SyntaxError: Unexpected token import

This happens because dist/maskedInput.js bundle is using import constructs shamelessly - this should be eliminated by Babel. Some Webpack envs handle this, some not, but Jest never.

artemv added a commit to artemv/vue-masked-input that referenced this issue Jul 4, 2018
Es2015 preset is deprecated now: https://babeljs.io/docs/en/env.html.
This also switches off {modules: false} babelrc option which makes the
bundle compatible with Jest and some other env configurations.

Fixes niksmr#52
Fixes niksmr#25
rinu pushed a commit to rinu/vue-masked-input that referenced this issue Jul 29, 2019
Merged #348, #339, #379, #385, #386

Closes #210, #336, #173, #200, niksmr#53, niksmr#51, niksmr#52, #324,
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

1 participant