Vue-jest: Babel 7 as Peer dependencies

Created on 25 Sep 2018  ยท  15Comments  ยท  Source: vuejs/vue-jest

https://github.com/vuejs/vue-jest/blob/master/package.json#L56

This line doesn't work
"babel-core@^6.25.0 || ^7.0.0-0"

Because @babel/core has changed of name as: "@babel/core"

bug

Most helpful comment

I am running into the similar warning. Running babel-core 7.7.5.

npm WARN [email protected] requires a peer of babel-core@^6.25.0 || ^7.0.0-0 but none is installed. You must install peer dependencies yourself.

All 15 comments

I think this should be considered quickly. Indeed the vue cli is moving fast and using jest with @babel/core setup instead of babel-core breaks the testing. So we need to keep babel-core as dependencies, especially for vue-jest.

Of cours it will mean breaking change for vue-jest as peer dependencies will move forward and dependencies toward babel plugins too.

Actually, I was wrong!
As ^7.0.0-0 is valid semver range
https://github.com/facebook/jest/issues/7061#issuecomment-425371766

I believe this issue can be closed

the fact is we should not rely on babel-core anymore but @babel/core without any bridge. But I guess since jest is not ready this must have to wait

But a lot of projects are still using babel-core and I believe they will still be using it for a while.

Yes, babel-core@^7.0.0-0 is a valid semantic range that will allow any alpha or beta version or the babel bridge of babel 7: https://semver.npmjs.com/, which includes @babel/core.

This issue can be closed.

No, It's not true.

I got this error with [email protected]:

Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.

This dependency: "@babel/plugin-transform-modules-commonjs": "^6.26.0" force to babel@6 alaways!

$>npm ls
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped

@babel/plugin-transform-modules-commonjs looks like a dependency after Babel 7.

I don't understand your problem: do you want to upgrade to Babel 7? (so do it)
If not, you do not need anything with babel @7.1.0.

You don't have to worry about dependencies. Npm or yarn will manage this. You only need to focus on peer dependencies.
Here they are all fine.

Well, vue-jest doesn't work for me unless I install babel-core@^7.0.0-0. That should not be necessary as I have @babel/core@^7.7.0 installed already.

$ yarn add --dev babel-jest @babel/core
...
warning " > [email protected]" has unmet peer dependency "babel-core@^6.25.0 || ^7.0.0-0".

I am running into the similar warning. Running babel-core 7.7.5.

npm WARN [email protected] requires a peer of babel-core@^6.25.0 || ^7.0.0-0 but none is installed. You must install peer dependencies yourself.

ditto โ˜๏ธ
warning " > [email protected]" has unmet peer dependency "babel-core@^6.25.0 || ^7.0.0-0".

currently I have "@babel/core": "^7.8.4", "jest": "^25.1.0", and "vue-jest": "^3.0.3"

same here

warning " > [email protected]" has unmet peer dependency "babel-core@^6.25.0 || ^7.0.0-0".

package json is including "@babel/core": "^7.8.4", "jest": "^24.9.0", "vue-jest": "^3.0.5"

Same here too...

npm WARN [email protected] requires a peer of babel-core@^6.25.0 || ^7.0.0-0 but none is installed.

And...

@babel/[email protected]
[email protected]
[email protected]

Additionally, when running my unit tests I also see many failed tests with output similar to the following:

 FAIL  src/components/__tests__/EmptyRouterView.test.js                                             
  โ— Test suite failed to run                                                                        

    Cannot find module 'babel-core'               
    Require stack:                                                                                  
    - /Users/ajb/src/rucka/node_modules/vue-jest/lib/compilers/babel-compiler.js                    
    - /Users/ajb/src/rucka/node_modules/vue-jest/lib/process.js                                     
    - /Users/ajb/src/rucka/node_modules/vue-jest/vue-jest.js 
    - /Users/ajb/src/rucka/node_modules/@jest/transform/build/ScriptTransformer.js                  
    - /Users/ajb/src/rucka/node_modules/@jest/transform/build/index.js                              
    - /Users/ajb/src/rucka/node_modules/jest-runtime/build/index.js                                 
    - /Users/ajb/src/rucka/node_modules/jest-runner/build/testWorker.js              
    - /Users/ajb/src/rucka/node_modules/jest-runner/node_modules/jest-worker/build/workers/processCh
ild.js                                                                                              

    Require stack:                                                                                  
      node_modules/vue-jest/lib/compilers/babel-compiler.js                                         
      node_modules/vue-jest/lib/process.js        
      node_modules/vue-jest/vue-jest.js
      node_modules/@jest/transform/build/ScriptTransformer.js                                       
      node_modules/@jest/transform/build/index.js                                                   
      node_modules/jest-runtime/build/index.js                                                      
      node_modules/jest-runner/build/testWorker.js                                                  
      node_modules/jest-runner/node_modules/jest-worker/build/workers/processChild.js

      at Object.<anonymous> (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lmiller1990 picture lmiller1990  ยท  9Comments

rmartins90 picture rmartins90  ยท  6Comments

syropian picture syropian  ยท  4Comments

emman27 picture emman27  ยท  7Comments

vincemukiiri picture vincemukiiri  ยท  9Comments