-
-
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
Babel config not loading correctly for --projects. #7771
Comments
After some more analysis... I think it is confusing that the behavior is different, but I haven't convinced myself that it's wrong, so I'll close this out. Thanks! |
I wonder if we should tell babel that We might get away with requiring people to set e.g. /cc @thymikee @rickhanlonii @rubennorte thoughts? |
I think the question is: what is the intention of Another consideration is a case like below which I would expect to "just work" when running
What are the proper babel programmatic options for files outside of project dir? Maybe |
It was, AFAIK, designed to run different projects in the same instance - e.g. |
In that case, I'm convinced that the current behavior isn't correct. |
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
Babel config is not loaded correctly for --projects, e.g.
jest --projects packages/pkg1
<-- failscd packages/pkg1 && jest
<-- passesTo Reproduce
The examples/react in the jest monorepo itself actually does exhibit this bug.
The bug is hidden because of
babelrcRoots: ['examples/*']
in the higher-level babel.config.js.Expected behavior
Behavior should be the same as running jest in the project's dir, e.g.
cd examples/react && jest
Details to reproduce
In this jest repo itself....
babelrcRoots: ['examples/*']
in top-level babel.config.js.yarn jest --projects examples/react/
<-- fails with message belowpushd examples/react && yarn jest
<-- passesFailure message
Analysis
The failure occurs because the babel config is not loaded with the proper cwd...the top-level cwd is used, instead of the project's rootDir. See here and here.
Also, when jest is loading configs, cwd in the project configs are set to the top-level (original) cwd here...not sure if that's the intention, seems like they should be set to each project's rootDir.
The text was updated successfully, but these errors were encountered: