Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

@robhogan
Copy link
Contributor

@robhoganrobhogan commentedFeb 22, 2025
edited
Loading

Summary

jest-haste-map'sworker currently enforces (or tries to enforce) that all of its workloads use the samehasteImplModulePath.

This is problematic when multiple configurations, whosehasteImplModulePath may differ, share ajest-haste-map worker - in particular:

  • when--runInBand or--maxWorkers=1
  • where there are sufficient configs thatMath.floor(maxWorkers / configs.length) == 1,
  • During watch mode, when alljest-file-map processing is in-band.

In these cases, whereworker.js is loaded as an ordinary module by the host process, there are two bugs:

  • If one project uses Haste and another does not,hasteImpl will 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.
  • If two configs try to use non-null, different haste impls, which should be valid, the worker will throw.

The point of this check seems to be to allow caching ofhasteImpl on the assumption that a given worker only sees one config. That caching doesn't really save any time though, becauserequire calls 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 wherejest-haste-map instances were allocatedMath.floor( (10-1) / 5 ) == 1 workers, and this change fixes it.

@netlify
Copy link

netlifybot commentedFeb 22, 2025
edited
Loading

Deploy Preview forjestjs ready!

Builtwithout sensitive environment variables

NameLink
🔨 Latest commit96453dd
🔍 Latest deploy loghttps://app.netlify.com/sites/jestjs/deploys/67b9fc8f3a3bea00080d5104
😎 Deploy Previewhttps://deploy-preview-15522--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site configuration.

@robhoganrobhogan changed the titlejest-haste-map: Fix clobbering/errors when multiple configs use different haste implsfix(jest-haste-map): Fix clobbering/errors when multiple configs use different haste implsFeb 22, 2025
Copy link
Member

@cpojercpojer left a 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.

@cpojercpojer merged commit54673fd intojestjs:mainMay 22, 2025
47 of 86 checks passed
@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 usingStackOverflow or ourdiscord channel for questions.

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsJun 22, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@cpojercpojercpojer approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@robhogan@cpojer

[8]ページ先頭

©2009-2025 Movatter.jp