3.0.0-beta.15
https://gitlab.com/kjell/vuecli
Run ui. Create a project. choose feature unit testing and jest.
The result of this process is pushed to the repo https://gitlab.com/kjell/vuecli
To reproduce
git clone https://gitlab.com/kjell/vuecli.git
cd vuecli/
npm install --dev
npm run test:unit
Expect test to pass
I get the following error:
Jest encountered an unexpected token
...
Details:
test_cli/tests/unit/HelloWorld.spec.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { shallowMount } from '@vue/test-utils'
^^^^^^
SyntaxError: Unexpected token import
I have tested this with beta 15 and beta 16.
Tested on Ubuntu, node v8.11.1
Edit: nvm it seems you removed Babel from the project...
This could be a bug
Thank you.
I am pretty sure I not removed babel on purpose and that Babel was checked in the new project wizard. I tried again now, creating new project. Making sure Jest and babel was chosen, and the same error occurs.
I saved as a preset. Is there any way to export this preset?
Hmm, ok so my commit fixed the issue when Babel was not selected, but it seems you actually wanted Babel.
So it looks more like a problem of creating the project through UI is unintentionally dropping the Babel plugin. That looks like something similar to #1479. /cc @Akryum
I'm received a similar error on and off since -beta.14. I just got it with -rc.1. (below).
The workaround I found here works for me: https://github.com/facebook/jest/issues/3202#issuecomment-312386525 - delete jest* from your temp dir.
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import "core-js/modules/es6
.promise";
^^^^^^
SyntaxError: Unexpected token import
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:402:17)
Most helpful comment
I'm received a similar error on and off since -beta.14. I just got it with -rc.1. (below).
The workaround I found here works for me: https://github.com/facebook/jest/issues/3202#issuecomment-312386525 - delete jest* from your temp dir.