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(runtime): handle async transforms of same module #11220

Merged
merged 2 commits into from
Mar 20, 2021

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Mar 20, 2021

Summary

The code currently ends up putting duplicate modules into the module cache, leading to different instances added to the cache (or rather, newer ones overriding old ones) which breaks referential identity.

We now have a sort of mutex on the cache key as well as asserting the cache does not have an entry for the cache key before we put the module into it.

Fixes #11214.

Test plan

Test added

referencingModule.context,
);
try {
const module = new SourceTextModule(transformedCode, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore whitespace

@codecov-io
Copy link

Codecov Report

Merging #11220 (7af697a) into master (420bcb7) will decrease coverage by 0.06%.
The diff coverage is 4.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11220      +/-   ##
==========================================
- Coverage   64.30%   64.24%   -0.07%     
==========================================
  Files         309      309              
  Lines       13485    13500      +15     
  Branches     3286     3288       +2     
==========================================
+ Hits         8672     8673       +1     
- Misses       4104     4118      +14     
  Partials      709      709              
Impacted Files Coverage Δ
packages/jest-runtime/src/index.ts 53.76% <4.76%> (-1.09%) ⬇️

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 420bcb7...7af697a. Read the comment docs.

@SimenB SimenB merged commit 129c08d into jestjs:master Mar 20, 2021
@SimenB SimenB deleted the async-transform-race branch March 20, 2021 08:25
@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 10, 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.

27.0.0-next.5 ESM loading regression
3 participants