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: calculated cache key based on supportsStaticESM #4248

Merged

Conversation

hnrqer
Copy link
Contributor

@hnrqer hnrqer commented Dec 28, 2023

Summary

ts-jest will generate different transformations if supportsStaticESM is true or false. I've noticed the issue when using jest with an esm globalSetup file in my application AND my tests were re-using imported files from the globalSetup.

globalSetup file seems is transpiled with supportsStaticESM unset here https://github.com/jestjs/jest/blob/4e56991693da7cd4c3730dc3579a1dd1403ee630/packages/jest-transform/src/ScriptTransformer.ts#L781

While tests had supportsStaticESM true in my case, and therefore, generating two different outputs.

Test plan

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@ahnpnl ahnpnl force-pushed the fix-calculated-cache-key-for-esm-vs-cjs branch from 342a959 to 69325d6 Compare January 19, 2024 10:23
@ahnpnl ahnpnl force-pushed the fix-calculated-cache-key-for-esm-vs-cjs branch from 69325d6 to 71142e9 Compare January 22, 2024 06:46
@ahnpnl ahnpnl merged commit a5d6f2d into kulshekhar:main Jan 22, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants