Jest tests fail to run from project created through vue-cli
See original GitHub issueVersion
3.0.0-beta.11
Reproduction link
Steps to reproduce
Following the guide here: https://vuejs-templates.github.io/webpack/ Select the following options during setup config:
- Vue Build: Runtime Compiler
- Install vue-router? No
- Use ESLint to lint your code? Yes
- Pick an ESLint preset: Standard
- Set up unit tests: Yes
- Pick a test runner: jest
- Setup e2e tests with Nightwatch? No
- Should we run
npm install
for you after the project has been created? yarn
What is expected?
The HelloWorld.spec.js test will run and pass.
What is actually happening?
Test suite failed to run
my-path/my-project/test/unit/setup.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Vue from 'vue';
^^^^^^
SyntaxError: Unexpected token import
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Cannot run Jest unit tests with @vue/cli-service : WEB-34734
The test as scaffolded by Vue CLI, works. You know this by running npm run test:unit - you'll see the test passes just...
Read more >Error in unit test a Vue 2 project to Vue 3 (vue-cli)
I get this error from running the base HelloWorld component that comes from the project scaffold. My dependencies are the following: " ...
Read more >vue/cli-plugin-unit-jest
Debugging Tests Note that directly running jest will fail because the Babel preset requires hints to make your code work in Node. js,...
Read more >Vue.js 3 Unit Testing Setup & Basics Tutorial - KoderHQ
Lesson Project · Jest is the framework used to perform unit testing. · Vue CLI Unit Jest Plugin installs and configures the necessary...
Read more >Setting up for TDD - Vue Testing Handbook
Create a new project by running vue create [project-name] . Choose "Manually select features" and "Unit Testing", and "Jest" for the test runner ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any possibilities this is fixable? it ried to clearCache but it still not working. do i need to add something on my babelrc? i havent touch anything about test and when i tried to create a test on my service and run it, it show this error. i tried to install this and that but it just introduce another series of chaining errors. this is the error when i run test ` FAIL /tests/myService.spec.js ● Test suite failed to run
`
@judgeyboy I’m getting basically the same problem when I run tests as well. It seems like it’s something with the webpack template, so I opened an issue there: https://github.com/vuejs-templates/webpack/issues/1404
I haven’t had time to dig into it yet, but at least there’s an issue open for now.