babel-jest plugin & babel 7 incompatibility
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior? babel-7-jest does work for me. babel-jest does not work for me.
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install
and yarn test
.
What is the expected behavior? When I run test suite using babel-7-jest:
When I run test suite using babel-jest:
TypeError: Cannot read property 'loose' of undefined (While processing preset: "/Users/alechp/Code/servexyz/repospace/cli/node_modules/@babel/preset-env/lib/index.js")
All that is required to make these tests pass is toggle the “transform” option in Jest config from “babel-jest” to “babel-7-jest” (note: I have both installed right now for easy swapping, but I have tried executing babel-jest after having removed babel-7-jest from dependencies and clearing cache)
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Relevant dependencies, jest configuration and babel configuration
"devDependencies": {
"@babel/core": "^7.0.0-beta.39",
"@babel/node": "^7.0.0-beta.39",
"@babel/preset-env": "^7.0.0-beta.39",
"babel-7-jest": "^21.3.3",
"babel-jest": "^22.2.2",
"jest": "^22.2.2"
},
"jest": {
"verbose": true,
"bail": false,
"collectCoverage": false,
"modulePathIgnorePatterns": ["sandbox", "node_modules"],
"transform": {
"^.+\\.jsx?$": "babel-jest"
}
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "9.3.0"
}
}
]
]
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:13 (2 by maintainers)
Top GitHub Comments
See the docs on using Jest with Babel 7: https://facebook.github.io/jest/docs/en/getting-started.html#using-babel
So I installed
babel-core@bridge
and I still get babel-core from jest-config and jest-runtime:maybe -config and -runtime should declare
babel-core
as a peerDependency?