Skip to content
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): import-local should be used in main jest pakage #5353

Merged
merged 3 commits into from
Jan 20, 2018

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jan 20, 2018

Summary
Related to #5304. I didn't test it well enough. That change worked with a globally installed jest-cli and a local installation of jest-cli. It did not work for a global jest install and a local jest install if jest-cli is within node_modules/jest/jest-cli instead 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-cli path) - and why I think so many projects have both jest and jest-cli in their dependencies.)

Test plan
Local testing with a globally installed jest (with this change applied) and a local node_modules/jest/jest-cli installation.

@codecov-io
Copy link

codecov-io commented Jan 20, 2018

Codecov Report

Merging #5353 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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        1

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4da1417...50dba85. Read the comment docs.

@cpojer cpojer merged commit b19f977 into jestjs:master Jan 20, 2018
@cpojer
Copy link
Member

cpojer commented Jan 20, 2018

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…

@SimenB SimenB deleted the import-local-jest branch January 20, 2018 16:37
@SimenB
Copy link
Member Author

SimenB commented Jan 20, 2018

It worked if jest-cli was hoisted to the top level, which is not necessarily the case.

$ 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'

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants