Skip to content
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

test:unit with jest can't find babel in freshly created project #1424

Closed
davestaab opened this issue May 31, 2018 · 1 comment
Closed

test:unit with jest can't find babel in freshly created project #1424

davestaab opened this issue May 31, 2018 · 1 comment

Comments

@davestaab
Copy link

davestaab commented May 31, 2018

Version

3.0.0-beta.15

Reproduction link

https://github.com/davestaab/vue-cli-jest-broken.git

Steps to reproduce

  1. install the new 3.0.0-beta.15 cli
  2. create a new app with vue create test-app
  3. select pwa, eslint, unit-jest e2e-cypress as the features
  4. run unit tests with npm run test:unit

Unit tests fail with error:

Test suite failed to run

Cannot find module '@babel/core'
    at Object.<anonymous> (node_modules/babel-core/index.js:2:18)

What is expected?

The basic unit test is expected to run and pass

What is actually happening?

The unit tests can't run and fails.
Error message is:

Test suite failed to run

Cannot find module '@babel/core'
    at Object.<anonymous> (node_modules/babel-core/index.js:2:18)

It seems to be related to the e2e-cypress plugin.
If I don't choose cypress I can get it to run the jest tests

@davestaab
Copy link
Author

davestaab commented Jun 1, 2018

More Info

I found the problem. I managed to make a vue cli preset without babel but with jest.

Here's my preset:

 "res-standard": {
      "useConfigFiles": true,
      "plugins": {
        "@vue/cli-plugin-pwa": {},
        "@vue/cli-plugin-eslint": {
          "config": "prettier",
          "lintOn": ["save", "commit"]
        },
        "@vue/cli-plugin-unit-jest": {},
        "@vue/cli-plugin-e2e-cypress": {}
      }
    }

Notice no mention of @vue/cli-plugin-babel.


So the question is how can we prevent someone else from making this mistake?

Is it true that jest is dependant on babel? If so should jest not be an option if you don't choose babel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant