Jest tests can't process import statement
### Version 3.0.0-rc.2 ### Reproduction link [https://github.com/ijdickinson/vue-cli-jest-problem](https://github.com/ijdickinson/vue-cli-jest-problem) ### Steps to reproduce This is a similar problem to [1475](https://github.com/vuejs/vue-cli/issues/1475), but I can't find a way to resolve it. I created a new app with vue-cli, selecting Jest tests. I added a simple POJO (`src/models/model.js`) and a test for it (`tests/model.spec.js`). To repro the problem, just `npm run test:unit` ### What is expected? Tests to pass, or at least run ### What is actually happening? $ npm run test:unit > test-application@0.1.0 test:unit /home/ian/workspace/project/test-application > vue-cli-service test:unit FAIL tests/unit/model.spec.js ● Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. You'll find mo
Posted by ijdickinson on Jun 15, 2018, 4:00 PM
Tags
Related issues
- Many devs love to shit on the guy from the 'I just want the exe.
- Now imagine how poor people stress if their smartphone bricks or gets damaged or lost.
- Resuming an extended-thinking session fails permanently with 400 "thinking blocks cannot be modified" (transcript stores thinking text as empty but keeps signat
- I'll preface this with a statement that as a European I want European alternatives to succeed, and MS-owned GitHub to shrivel and disappear.
- Yeah, but there’s a world of difference between “not perfect” and “we rounded a few sliders, and now the modal is a nightmare to use”.
- I used to write a lot of native Windows corporate software in the 90's and 2000's and my standard login window was a floating draggable o...
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
reliability (SaaS)
Many devs love to shit on the guy from the 'I just want the exe.
Now imagine how poor people stress if their smartphone bricks or gets damaged or lost.
Resuming an extended-thinking session fails permanently with 400 "thinking blocks cannot be modified" (transcript stores thinking text as empty but keeps signat
I'll preface this with a statement that as a European I want European alternatives to succeed, and MS-owned GitHub to shrivel and disappear.
Yeah, but there’s a world of difference between “not perfect” and “we rounded a few sliders, and now the modal is a nightmare to use”.
I used to write a lot of native Windows corporate software in the 90's and 2000's and my standard login window was a floating draggable o...
App broken with Mosquitto broker 7.0.0
[BUG] Remote Control: automatic reconnection doesn't work -- connection drops silently with no recovery
Jest tests can't process import statement
### Version 3.0.0-rc.2 ### Reproduction link [https://github.com/ijdickinson/vue-cli-jest-problem](https://github.com/ijdickinson/vue-cli-jest-problem) ### Steps to reproduce This is a similar problem to [1475](https://github.com/vuejs/vue-cli/issues/1475), but I can't find a way to resolve it. I created a new app with vue-cli, selecting Jest tests. I added a simple POJO (`src/models/model.js`) and a test for it (`tests/model.spec.js`). To repro the problem, just `npm run test:unit` ### What is expected? Tests to pass, or at least run ### What is actually happening? $ npm run test:unit > test-application@0.1.0 test:unit /home/ian/workspace/project/test-application > vue-cli-service test:unit FAIL tests/unit/model.spec.js ● Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. You'll find mo
Comments (0)
No comments yet. Start the discussion.