You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using babel-jest in a project using Babel 7, babel-jest still attempts to transform code using babel-core@6 (because it is specified as a dependency rather than a peerDependency), which is not necessarily compatible with the plugins/presets that the user will have included in the project.
For example, I have a project using Babel 7 and the babel-plugin-transform-object-rest-spread Babel plugin. If I have version 7.0.0-alpha.15 installed, babel-jest behaves as if the plugin is not referenced at all, throwing the error:
However, if the version of babel-core installed as a dependency of babel-jest is changed to version 7.0.0-alpha.15, the plugin is used correctly and the code is transpiled as expected.
What is the expected behavior?
It seems to me that the obvious solution to this would be to change babel-core to be a peerDependency instead of a dependency, since any projects that rely on babel-jest presumably have to have babel-core installed anyway. Even though this would be a breaking change it would maintain backwards compatibility with Babel 6. I have tested and confirmed on my machine that modifying the package.json as follows fixes the issue.
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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using
babel-jest
in a project using Babel 7,babel-jest
still attempts to transform code usingbabel-core@6
(because it is specified as a dependency rather than a peerDependency), which is not necessarily compatible with the plugins/presets that the user will have included in the project.For example, I have a project using Babel 7 and the
babel-plugin-transform-object-rest-spread
Babel plugin. If I have version7.0.0-alpha.15
installed,babel-jest
behaves as if the plugin is not referenced at all, throwing the error:However, if the version of
babel-core
installed as a dependency ofbabel-jest
is changed to version7.0.0-alpha.15
, the plugin is used correctly and the code is transpiled as expected.What is the expected behavior?
It seems to me that the obvious solution to this would be to change
babel-core
to be a peerDependency instead of a dependency, since any projects that rely onbabel-jest
presumably have to havebabel-core
installed anyway. Even though this would be a breaking change it would maintain backwards compatibility with Babel 6. I have tested and confirmed on my machine that modifying thepackage.json
as follows fixes the issue.The text was updated successfully, but these errors were encountered: