fix(jest): import-local should be used in main jest pakage#5353
fix(jest): import-local should be used in main jest pakage#5353cpojer merged 3 commits intojestjs:masterfrom
import-local should be used in main jest pakage#5353Conversation
Codecov Report
@@ Coverage Diff @@
## master #5353 +/- ##
=======================================
Coverage 61.29% 61.29%
=======================================
Files 205 205
Lines 6917 6917
Branches 3 4 +1
=======================================
Hits 4240 4240
Misses 2676 2676
Partials 1 1Continue to review full report at Codecov.
|
|
Dang, I thought about this but thought it would work because jest just goes to jest-cli, but I guess it's requiring the wrong version of jest-cli… |
|
It worked if $ tree
├── node_modules
│ └── module-a
│ ├── node_modules
│ │ └── module-b
│ │ └── package.json
│ └── package.json
└── package.json
$ node -p 'require.resolve("module-b")'
Error: Cannot find module 'module-b' |
|
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
Related to #5304. I didn't test it well enough. That change worked with a globally installed
jest-cliand a local installation ofjest-cli. It did not work for a globaljestinstall and a localjestinstall ifjest-cliis withinnode_modules/jest/jest-cliinstead of at the top level.This change fixes that.
(I want to point out that the original code before #5304 didn't work in the same case (as it hardcoded a
node_modules/jest-clipath) - and why I think so many projects have bothjestandjest-cliin their dependencies.)Test plan
Local testing with a globally installed
jest(with this change applied) and a localnode_modules/jest/jest-cliinstallation.