Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6.6k
fix(jest-haste-map): Fix clobbering/errors when multiple configs use different haste impls#15522
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
netlifybot commentedFeb 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview forjestjs ready!Builtwithout sensitive environment variables
To edit notification comments on pull requests, go to yourNetlify site configuration. |
cpojer left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This looks like a piece of code that existed because it wasn't supposed to happen at FB, and now it is happening. Heh.
54673fd intojestjs:mainUh oh!
There was an error while loading.Please reload this page.
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. |
Uh oh!
There was an error while loading.Please reload this page.
Summary
jest-haste-map'sworkercurrently enforces (or tries to enforce) that all of its workloads use the samehasteImplModulePath.This is problematic when multiple configurations, whose
hasteImplModulePathmay differ, share ajest-haste-mapworker - in particular:--runInBandor--maxWorkers=1Math.floor(maxWorkers / configs.length) == 1,jest-file-mapprocessing is in-band.In these cases, where
worker.jsis loaded as an ordinary module by the host process, there are two bugs:hasteImplwill be set by the first config and incorrectly silently reused by the second config (because we don't trigger the error condition, but do reusehasteImpl), potentially causing spurious collision errors.The point of this check seems to be to allow caching of
hasteImplon the assumption that a given worker only sees one config. That caching doesn't really save any time though, becauserequirecalls are already backed by Node's own module cache.So we simplify the worker, fix the bugs, and incur no observable performance penalty by just removing the check.
Test plan
Made this modification locally to Jest at Meta, where we currently have 5 projects including 2 different haste impls. We observed the bug on 10 core machines where
jest-haste-mapinstances were allocatedMath.floor( (10-1) / 5 ) == 1workers, and this change fixes it.