I am struggling to run all my tests within WebStorm. I set up a project with Babel, TypeScript, and Vue using vue-cli 3.0.0-rc3. My run configuration looks like this:
https://i.stack.imgur.com/7H0x3.png
Unfortunately, I encountered the following error:
● Test suite failed to run
/Users/calberca/Tmp/test-3/src/components/HelloWorld.vue:2
import "core-js/modules/es6.promise";
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected string
1 | import { shallowMount } from "@vue/test-utils";
> 2 | import HelloWorld from "../HelloWorld.vue";
| ^
3 |
4 | describe("HelloWorld.vue", () => {
5 | it("renders props.msg when passed", () => {
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
at Object.<anonymous> (src/components/__tests__/HelloWorld.spec.ts:2:1)
Running yarn test:unit
in the console passes the test, but running jest --config=jest.config.js
causes it to fail.
My assumption is that ts-jest might not be properly transforming the code with Babel, and I suspect that there might be a setting in vue-cli that handles this. However, I am unsure of how to adjust my command to make it work.
Note: In a larger project, about 80% of the tests pass, but some still fail due to similar ES6-related errors.
Edit
Surprisingly, the issue was resolved after updating to Webstorm 2018.3 without any additional modifications :)