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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve bundled modules from correct location #11493

Merged
merged 2 commits into from Jun 3, 2021

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented May 31, 2021

Summary

Take 2 at fixing #11452. This time by passing in require.resolve from the modules that do the require so that it looks like it's e.g. jest-config doing the require.resolve rather than jest-resolve, thus satisfying the dependency

Test plan

馃し

@SimenB
Copy link
Member Author

SimenB commented May 31, 2021

@merceyz sorry to ping you, but do you have any tips for how to make the script I added as a "test" work? Using just portal:/path/to/jest makes yarn install the rest of the dependencies from npm rather that resolve locally. I tried adding resolutions for all packages, but that didn't help.

Using link instead of portal means the binary script is not added

@codecov-commenter
Copy link

Codecov Report

Merging #11493 (d007a65) into master (82d1a1a) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11493      +/-   ##
==========================================
- Coverage   68.95%   68.94%   -0.02%     
==========================================
  Files         312      312              
  Lines       16310    16314       +4     
  Branches     4722     4726       +4     
==========================================
  Hits        11247    11247              
- Misses       5035     5039       +4     
  Partials       28       28              
Impacted Files Coverage 螖
packages/jest-config/src/normalize.ts 89.09% <酶> (酶)
packages/jest-resolve/src/utils.ts 24.32% <0.00%> (-2.95%) 猬囷笍
packages/jest-runner/src/runTest.ts 3.47% <酶> (酶)

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 82d1a1a...d007a65. Read the comment docs.

@SimenB SimenB force-pushed the resolve-modules-from-requiring-module branch from d007a65 to c94ec5d Compare June 3, 2021 08:18
@SimenB SimenB linked an issue Jun 3, 2021 that may be closed by this pull request
@SimenB SimenB merged commit d6fb0d8 into jestjs:master Jun 3, 2021
@SimenB SimenB deleted the resolve-modules-from-requiring-module branch June 3, 2021 08:19
@SimenB
Copy link
Member Author

SimenB commented Jun 3, 2021

Moved test to #11513

@merceyz
Copy link
Contributor

merceyz commented Jun 3, 2021

@SimenB No worries, responded in #11513 (comment)

@merceyz
Copy link
Contributor

merceyz commented Jun 3, 2021

Instead of passing the require function around, wouldn't passing the filepath instead be better?
jest-resolve could then do

require.resolve(module, { paths: [filepath] })`

@SimenB
Copy link
Member Author

SimenB commented Jun 3, 2021

Passing in __filename? That can probably work as well!

@merceyz
Copy link
Contributor

merceyz commented Jun 3, 2021

Depends on where it should be resolved relative to, but yeah

@github-actions
Copy link

github-actions bot commented Jul 4, 2021

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 Jul 4, 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.

Unable to run jest after 26 to 27 version bump with Yarn 3's PnP
4 participants