-
-
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
fix(jest-cli): use import-local
to support global Jest installations
#5304
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5304 +/- ##
=======================================
Coverage 61.25% 61.25%
=======================================
Files 205 205
Lines 6893 6893
Branches 4 4
=======================================
Hits 4222 4222
Misses 2670 2670
Partials 1 1 Continue to review full report at Codecov.
|
Oh this is cool. Just to clarify we need the added dependency, does |
I'm sure we could add some way to have the same logic in |
Works for me. Thanks for the explanation. |
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
We have some custom code to check for
<rootDir>/node_modules/jest-cli
and if it's there, use it. This is (from what I can understand) to support using a global Jest installation to run a local installation.The problem is that it breaks the assumption of node resolution algorithms, leading to weird errors like #5119.
This PR replaces the logic within
jest-cli
to useimport-local
in the entry point, similar to howxo
,webpack-dev-server
etc. do it.The theory is that you only want this logic when running jest as a binary, not when using the programmatic API. Might be considered a breaking change, dunno?
Fixes #5294.
Test plan
I'm not sure how to properly test installing jest globally. Is it good enough to do
yarn link
and running the global bin? If so, this works.