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

chore(resolver): reuse cached lookup of package.json files #11969

Merged
merged 8 commits into from
Oct 17, 2021

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Oct 17, 2021

Summary

Supporting exports field will lead us to reading way more package.json files than before, so in preparation we should try to make these caches cooperate and populate the same one.

I've also dropped escalade as it does a bunch of statSync calls - we do as well and cache them, so re-using makes sense.

Lastly, I've moved the clearing of these caches until just before running tests (instead of only before runs in watch mode) in case some resolution is different between config loading and test running

Test plan

Green CI

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2021

Codecov Report

Merging #11969 (42c5139) into main (696c472) will decrease coverage by 0.04%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11969      +/-   ##
==========================================
- Coverage   68.76%   68.72%   -0.05%     
==========================================
  Files         322      323       +1     
  Lines       16621    16631      +10     
  Branches     4797     4799       +2     
==========================================
- Hits        11430    11429       -1     
- Misses       5158     5169      +11     
  Partials       33       33              
Impacted Files Coverage Δ
packages/jest-core/src/watch.ts 86.36% <ø> (-0.07%) ⬇️
packages/jest-resolve/src/defaultResolver.ts 85.71% <ø> (-2.97%) ⬇️
packages/jest-resolve/src/resolver.ts 55.86% <0.00%> (ø)
packages/jest-resolve/src/shouldLoadAsEsm.ts 9.30% <0.00%> (+0.60%) ⬆️
packages/jest-resolve/src/fileWalkers.ts 69.49% <69.49%> (ø)
packages/jest-core/src/runJest.ts 68.75% <100.00%> (+0.32%) ⬆️
packages/expect/src/utils.ts 95.85% <0.00%> (-0.52%) ⬇️

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 696c472...42c5139. Read the comment docs.

@SimenB SimenB merged commit b5aec03 into jestjs:main Oct 17, 2021
@SimenB SimenB deleted the reuse-package-loading branch October 17, 2021 17:22
@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 Nov 17, 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.

3 participants