Skip to content

fix(jest-runtime): bind jest.isolateModulesAsync to this - #14083

Merged
SimenB merged 2 commits into
jestjs:mainfrom
tjenkinson:fix-isolate-modules-async
Apr 19, 2023
Merged

SimenB merged 2 commits into
jestjs:mainfrom
tjenkinson:fix-isolate-modules-async

Conversation

@tjenkinson

Copy link
Copy Markdown
Contributor

Summary

jest.isolateModulesAsync currently doesn't work as this is not bound to the correct object. this._isolatedModuleRegistry on the actual instance doesn't get set so isolateModulesAsync is essentially a no-op.

Test plan

Added a new test that fails without the fix.

@tjenkinson
tjenkinson force-pushed the fix-isolate-modules-async branch from abd28ba to e6c7f99 Compare April 18, 2023 16:18
@tjenkinson
tjenkinson marked this pull request as ready for review April 18, 2023 16:27
runtime.__mockRootPath,
'ModuleWithState',
);
expect(exports.getState()).toBe(1);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this would fail before

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great catch!

@SimenB
SimenB merged commit 77c2c6e into jestjs:main Apr 19, 2023
@pwasem

pwasem commented Apr 27, 2023

Copy link
Copy Markdown

@tjenkinson I am currently facing this issue that jest.isolateModulesAsync is not working as expected using [email protected].

any idea in which release this fix will be included?

DmitryMakhnev pushed a commit to DmitryMakhnev/jest that referenced this pull request May 5, 2023
@github-actions

Copy link
Copy Markdown

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 28, 2023
@SimenB

SimenB commented Jul 4, 2023

Copy link
Copy Markdown
Member

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.

4 participants