jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
43.93k stars 6.41k forks source link

[Feature]: Support Babel v8 #15152

Open latin-1 opened 1 month ago

latin-1 commented 1 month ago

🚀 Feature Proposal

Add support for Babel v8. https://github.com/babel/babel/issues/10746

Currently, using babel-jest and @babel/core@8 produces this error:

Requires Babel "^7.0.0-0", but was loaded with "8.0.0-alpha.11". 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: "/.../node_modules/@babel/plugin-syntax-object-rest-spread/lib/index.js")

Furthermore, we could add an option to babel-jest to opt-out the babel-preset-jest (especially, babel-preset-current-node-syntax, which does not make much sense if the developer specified their own babel config).

Motivation

.

Example

No response

Pitch

.

SimenB commented 4 weeks ago

Supporting Babel 8 makes sense, happy to take a PR that expands our range (including tests).


Could you file a separate feature request for a way to opt out of the Jest preset? Note that this will break jest.mock hoisting etc.