-
Notifications
You must be signed in to change notification settings - Fork 1k
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 encountered an unexpected token with spin.js #364
Comments
I fixed it on temporary. /node_modules/spin.js/spin.js at line 79 I hope to fix it next version. |
This still seems to be an issue. |
For Laravel devs using mix, using mix.js... will sort out this issue |
It looks like Jest may need to be configured with Babel to handle ES6 modules: jestjs/jest#2550. |
I'm having this same issue. Has anyone had any luck finding a permanent fix for this? |
Nevermind. It's not working. |
Assuming that you don't actually need to test the internals of Spin.js, you can mock it: in your Jest config: moduleNameMapper": {
"spin.js": "<rootDir>/test/__mocks__/spinMock.js",
}, in spinMock.js: module.exports = {}; |
Mocking suggestion by @JCB-K works, and I would say that it's a better solution to mock it, but you can also try using the transform ignore "transformIgnorePatterns": [
"/node_modules/(?!spin.js).+\\.js$"
], |
I'm unable to get "transformIgnorePatterns" to work to fix this for some reason, have tried quite a few variations at this point. EDIT: Solved it: https://stackoverflow.com/questions/50147915/jest-transformignorepatterns-not-working |
FAIL src/tests/App.test.js
● Test suite failed to run
The text was updated successfully, but these errors were encountered: