Maybe you may help me? I try to configure jest to use babel@7 So I have:
\"jest\": \"^23.4.1\",
\"@babel/core\": \"^7.0.0-beta.54\",
\"babel-7-jest\": \"^21.3.3\
I believe I have found a working solution (no thanks to the Jest team providing broken documentation and evading GitHub issues around this issue).
You need the following in your devDependencies
section of your package.json
:
"devDependencies": {
"@babel/core": "^7.0.0-beta.54",
"@babel/preset-env": "^7.0.0-beta.54",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.0",
"bili": "^3.1.2",
"jest": "^23.4.1",
"regenerator-runtime": "^0.12.0"
}
The following in your .babelrc
:
{
"presets": [
[
"@babel/preset-env",
{
"debug": false,
"targets": {
"browsers": [
"last 3 versions"
]
}
}
]
]
}
In my particular project I did not need to use the Jest config so I deleted my empty jest.config.js
file.
Key points:
babel-7-jest
as this is deprecated as there is now official support for it.@babel/xyz
packages going forward - the babel-core
bridge one I have installed is the "official" way to use latest Babel 7. I imagine this need will be removed at some point in the future as everything migrates to Babel 7.import/export
and no longer need the antiquated require()
.Edit:
If you want to have a more detailed log of passing/failing tests then put this in your jest.config.js
:
module.exports = {
"verbose": true
}