-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: jest.isolateModulesAsync does not work with ESM modules #14387
Comments
It works with CJS, but fails with ESM modules. There is no need to have jest/packages/jest-runtime/src/index.ts Lines 181 to 183 in 0fd5b1c
|
@patrickdawson Could you add a title to this issue, please? Something, like: " |
Thanks for the quick follow up. I updated the title and the code example in the repository to verify that cjs indeed works. If this is not an easy fix maybe add a hint to the docs so it becomes clear that only cjs is supported at the moment. |
@mrazauskas Can I pick up this? |
Sure. Would be nice to fix this. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
29.6.2
Steps to reproduce
Steps to reproduce:
Test shows the error
Expected behavior
In this testcase
I expect according to the docs https://jestjs.io/docs/jest-object#jestisolatemodulesasyncfn that each
isolateModulesAsync
context has its own 'fresh" module so all module variables should be in the intial state. The test shows that this is not the caseActual behavior
The state of the previous
isolateModulesAsync
context affects the second scope.Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: