-
-
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
Add Babel 7 support to babel-preset-jest #6126
Comments
Notable changes: * All official packages have moved under the `@babel/` namespace and in some cases further renamed, so package names adjusted accordingly. * `@babel/preset-env` now includes `@babel/plugin-transform-spread` and `@babel/plugin-transform-classes`, which are the Babel 7 renames of `babel-plugin-transform-object-rest-spread` and `babel-plugin-transform-es2015-classes`. * `@babel/preset-env`'s `useBuiltIns: true` mode has been renamed to `useBuiltIns: 'entry'` - which is equivalent. * `@babel/preset-react` now has `development` and `useBuiltIns` options, which we set appropriately: https://github.com/babel/babel/tree/v7.0.0-beta.46/packages/babel-preset-react#options * `babel-plugin-dynamic-import-node` is no longer required by `@neutrinojs/library` for target `node`, since webpack converts the dynamic import to a require itself. * `@neutrinojs/jest` required more substantial changes since: - the custom transformer used the now removed `canCompile()` from Babel's API. - `babel-preset-jest` is not fully compatible with Babel 7 (jestjs/jest#6126). * Several packages now have a peer dependency on `@babel/core`, so it's been added where necessary. * `babel-loader` has been updated to v8 for Babel 7 compatibility. * `@neutrinojs/vue`'s `babel-preset-vue` dependency doesn't appear to be used, but has been left as is pending #836. Closes #316.
PR welcome! A function should work fine for Babel 6 as well. As a workaround you can create your own file which does |
Notable changes: * All official packages have moved under the `@babel/` namespace and in some cases further renamed, so package names adjusted accordingly. * `@babel/preset-env` now includes `@babel/plugin-transform-spread` and `@babel/plugin-transform-classes`, which are the Babel 7 renames of `babel-plugin-transform-object-rest-spread` and `babel-plugin-transform-es2015-classes`. * `@babel/preset-env`'s `useBuiltIns: true` mode has been renamed to `useBuiltIns: 'entry'` - which is equivalent. * `@babel/preset-react` now has `development` and `useBuiltIns` options, which we set appropriately: https://github.com/babel/babel/tree/v7.0.0-beta.46/packages/babel-preset-react#options * `babel-plugin-dynamic-import-node` is no longer required by `@neutrinojs/library` for target `node`, since webpack converts the dynamic import to a require itself. * `@neutrinojs/jest` required more substantial changes since: - the custom transformer used the now removed `canCompile()` from Babel's API. - `babel-preset-jest` is not fully compatible with Babel 7 (jestjs/jest#6126). * Several packages now have a peer dependency on `@babel/core`, so it's been added where necessary. * `babel-loader` has been updated to v8 for Babel 7 compatibility. * `@neutrinojs/vue`'s `babel-preset-vue` dependency doesn't appear to be used, but has been left as is pending #836. Closes #316.
Notable changes: * All official packages have moved under the `@babel/` namespace and in some cases further renamed, so package names adjusted accordingly. * `@babel/preset-env` now includes `@babel/plugin-transform-spread` and `@babel/plugin-transform-classes`, which are the Babel 7 renames of `babel-plugin-transform-object-rest-spread` and `babel-plugin-transform-es2015-classes`. * `@babel/preset-env`'s `useBuiltIns: true` mode has been renamed to `useBuiltIns: 'entry'` - which is equivalent. * `@babel/preset-react` now has `development` and `useBuiltIns` options, which we set appropriately: https://github.com/babel/babel/tree/v7.0.0-beta.46/packages/babel-preset-react#options * `babel-plugin-dynamic-import-node` is no longer required by `@neutrinojs/library` for target `node`, since webpack converts the dynamic import to a require itself. * `@neutrinojs/jest` required more substantial changes since: - the custom transformer used the now removed `canCompile()` from Babel's API. - `babel-preset-jest` is not fully compatible with Babel 7 (jestjs/jest#6126). * Several packages now have a peer dependency on `@babel/core`, so it's been added where necessary. * `babel-loader` has been updated to v8 for Babel 7 compatibility. * `@neutrinojs/vue`'s `babel-preset-vue` dependency doesn't appear to be used, but has been left as is pending #836. Closes #316.
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. |
Hi :-)
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Attempting to use
babel-preset-jest
with Babel 7 beta 46 roughly like so:(sorry for not a full example; it's deeply intertwined with Neutrino and the cause is clear from code-inspection below)
...results in:
This is because as of babel/babel#6494, presets must export something like:
...whereas babel-preset-jest exports an object:
https://github.com/facebook/jest/blob/da60c7811bb808c474e7ef887884e5d00cffa115/packages/babel-preset-jest/index.js#L8-L14
babel-jest appears to work around this by importing the contents of the preset and
.concat()
ing it directly:https://github.com/facebook/jest/blob/cf2b9e80a0b099c2f861660fd9cf589848106fa1/packages/babel-jest/src/index.js#L77
What is the expected behavior?
That the
.concat()
workaround not be required when using babel-preset-jest directly (which is required for use-cases like those in #1468).Please provide your exact Jest configuration
The config we're using under Babel 6 (the Babel 7 branch is a local WIP; but
master
should give the context as to use case) is here:https://github.com/mozilla-neutrino/neutrino-dev/blob/c725322e0e7fe62783cc3b6d78b46be1793c51a7/packages/jest/src/index.js
https://github.com/mozilla-neutrino/neutrino-dev/blob/c725322e0e7fe62783cc3b6d78b46be1793c51a7/packages/jest/src/transformer.js
Run
npx envinfo --preset jest
in your project directory and paste theresults here
I use yarn rather than npm so don't have npx installed. Perhaps it would be good to update the template with the yarn equivalents?
The text was updated successfully, but these errors were encountered: