-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jest 24 with babel 6 and babel-jest 23 #8230
Comments
That's weird, I could have sworn I tested it... #5932 explicitly uses @arcanis could we do something like try {
babelJest = Resolver.findNodeModule('babel-jest', {basedir});
} catch (e) {
// ignored
}
if (!babelJest) {
babelJest = require.resolve('babel-jest');
}
options.transform = {
[DEFAULT_JS_PATTERN]: babelJest,
}; instead of just |
@jochakovsky workaround is to add a module.exports = {
transform: {
'^.+\\.[jt]sx?$': require.resolve('babel-jest')
}
}; |
@SimenB Thank you, the workaround works for me! |
@SimenB can you add this to official document ? I met this issue with babel@6 / jest@24 / babel-jest@23 at the same time |
package.json
.babelrc
Run
|
@lin-credible The issue might be that you installed version 24 of babel-jest as opposed to version 23. I just installed version 23 and added the transform to my package.json file and it works as expected. |
No it does not.
|
Hi there, i'm using NPM here, and this issue still happens, but my error message is
using jest@24, babel-jest@23, and babel 6 EDIT: Solved the issue by downgrade jest to jest@23 👌 |
using jest 24 with babel 6 and babel-jest 23 with the workaround I'm getting this error Plugin / Preset files are not allowed to export objects only functions .. ! |
I got passed that error by adding the following at the end of my babelrc:
This way, my whole babelrc file content looks like this:
But I can't get passed the following error when trying to write test cases for some React action generators:
Apparently, jest doesn't understand ES6 import statement, and I've tried many different things, including downgrading jest, none of them worked. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
Re-opening #8155
I've been unsuccessful at following the documentation for running Jest 24 with Babel 6. Specifically, I'm seeing this error:
If using Yarn, one possible workaround is adding
"resolutions": {"babel-jest": "23.6.0"}
to package.json.To Reproduce
yarn install
yarn run test
Expected behavior
Jest 24 should transpile test and src files using Babel 6
Link to repl or repo (highly encouraged)
https://github.com/jochakovsky/Jest-24-Babel-6-preset-bug
Run
npx envinfo --preset jest
The text was updated successfully, but these errors were encountered: