I'm trying to set up Jest in an ES6 project. Didn't get far, since as soon as I run jest, I start running into problems.
.babelrc
{
"presets": [
"@babel/env"
]
}
The above throws a Couldn't find preset "@babel/env" relative to directory error when running Jest. Which is fine I guess, since it should be @babel/preset-env either way? (both work with the rest of my setup though...)
But! When I change the preset to @babel/preset-env, the error I'm receiving is very confusing:
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. (While processing preset: "/Users/.../node_modules/@babel/preset-env/lib/index.js")
Which is very strange, since my devDeps of Babel and Jest are set to:
"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"@babel/register": "^7.0.0",
"babel-jest": "^23.6.0"
}
As far as I can tell, that error message makes exactly zero sense. My next thought was to check my global Babel CLI installation, which was babel-cli@6.26.0. Closer, but it's not 6.26.3 as stated in the error message. I also tried replacing the global package with the latest @babel/cli, but it made no difference.
What might I be missing here?
![2]](https://i.stack.imgur.com/u8iCg.png)