fix(jest-cli): use import-local to support global Jest installations#5304
fix(jest-cli): use import-local to support global Jest installations#5304cpojer merged 2 commits intojestjs:masterfrom
import-local to support global Jest installations#5304Conversation
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 1Continue 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-cliand 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-clito useimport-localin the entry point, similar to howxo,webpack-dev-serveretc. 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 linkand running the global bin? If so, this works.