Another reason to start with the official docs. They often hold the answers!
Why The Error Happens
Okay, so the Jest team is aware of the problem, but what is actually happening and what is
babel-core@^7.0.0-bridge.0
?
When the babel team upgraded to
v7
, they changed the syntax for their updates from
babel-core
(
v6
) to
@babel/core
(
v7
).
This meant that every package that used
babel
as a peer dependency would be forced to make a breaking change to update along with Babel.
The Babel team created the problem with their name change. They also created a fix. That’s what
babel-core@^7.0.0-bridge.0
does.
Instead of forcing all package maintainers that used Babel as a peer dependency to update their package, the bridge allows them to keep using Babel without pushing a breaking change.
Stack Trace
FAIL jestTests/app.test.js
● Test suite failed to run
Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @ba
bel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace
of this error to lookfor the first entry that doesn't mention "@babel/core" or "babel-core" to see what is call
ing Babel. (While processing preset: "/Users/Stephen/Documents/_coding/matilda/node_modules/@babel/preset-env/lib
/index.js")
at throwVersionError (node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
at Object.assertVersion (node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
at _default (node_modules/@babel/preset-env/lib/index.js:154:7)
at node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:317:46
at Array.map (<anonymous>)
at OptionManager.resolvePresets (node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)