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

Jest SyntaxError: Unexpected token export #39

Open
toddsampson opened this issue May 23, 2019 · 2 comments
Open

Jest SyntaxError: Unexpected token export #39

toddsampson opened this issue May 23, 2019 · 2 comments

Comments

@toddsampson
Copy link

I know an issue isn't the best place for this, but I thought it should be documented somewhere.

Vue-timers was working as a global import or mixin in my app. However, it completely broke all my Jest tests. The errors thrown varied from TypeError: Cannot read property 'setData' of undefined to SyntaxError: Unexpected token export depending on what I tried to fix it.

I finally realized that I needed to update my jest.config.js from:

  transformIgnorePatterns: [
    'node_modules/',
  ],

to

  transformIgnorePatterns: [
    'node_modules/?!(vue-timers)',
  ],

This is probably obvious for someone with more Jest experience, but I figured I should document what I found since it took me way too long to track down.

@pattrickrice
Copy link

Unfortunately this did not solve the problem on my project.

@naomiaro
Copy link

@pattrickrice I had to also add, was missing this before.

transform: {
  '^.+\\.js$': 'babel-jest'
}

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

3 participants