-
-
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
Change babel-core to peerDependency for compatibility with Babel 7 #4162
Conversation
This makes babel-jest compatible with whichever version of Babel is used in a given project, since babel-core@6 is not necessarily compatible with plugins made for Babel 7. Note that this is a breaking change (albeit low impact).
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Seems like this at least breaks Circle |
Ah I think I see why this is a problem now. The tests worked on my machine because I had misguidedly deleted the node_modules folder from the In any case though, do you agree with the general idea of changing this to a peerDependency? |
Yeah, I think that's reasonable. |
We've done this in babel-loader for a while https://github.com/babel/babel-loader/blob/f0bbb68ad484b5211926dafb57f25fd418d06dc4/package.json#L18 Might need to do the same if we release beta/rc 😛 |
…estjs#4162) * Change babel-core to peerDependency for compatibility with Babel 7 This makes babel-jest compatible with whichever version of Babel is used in a given project, since babel-core@6 is not necessarily compatible with plugins made for Babel 7. Note that this is a breaking change (albeit low impact). * Revert babel-core upgrade to 7.x
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This makes
babel-jest
compatible with whichever version of Babel is used in a given project, sincebabel-core@6
is not necessarily compatible with plugins made for Babel 7.Note that this is a breaking change (albeit low impact).
Fixes #4055 (
babel-jest
is incompatible with plugins made for Babel 7).Test plan
In a project using
[email protected]
and the following Babel packages:Install
babel-jest
using:I run tests using a
.jestrc.js
config file (however the extra config can be omitted for this example):The command fails with errors such as the following (indicating that JSX has not been transformed by Babel):
I published this fork of
babel-jest
as an npm package and installed it in the project as follows (public so that anyone can reproduce this):Then modified the jest
transform
configuration to use it (instead ofbabel-jest
which is default):.jestrc.js
Then run the tests again using
jest --config .jestrc.js
and see that all is well:Note that although this is technically a breaking change, in general users should already have
babel-core
installed with their project, so I would expect impact to be minimal.Also note that I've run the unit tests on my own (Windows) machine and they all pass, including at least some that fail in the CI runs. From what I can see, these tests seem to have been failing in CI already prior to this commit.