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

Preserve imports when needed in Jest integration #752

Merged
merged 2 commits into from
Oct 7, 2022

Conversation

alangpierce
Copy link
Owner

Fixes #741

When Jest is run with ESM enabled, it passes in either supportsDynamicImport or supportsStaticESM depending on whether the code is targeting ESM or CJS. The integration now configures Sucrase accordingly, which should be enough for the integration to just work with an ESM Jest configuration.

Fixes #741

When Jest is run with ESM enabled, it passes in either `supportsDynamicImport`
or `supportsStaticESM` depending on whether the code is targeting ESM or CJS.
The integration now configures Sucrase accordingly, which should be enough for
the integration to just work with an ESM Jest configuration.
@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Merging #752 (f535ef0) into main (755e3ed) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #752   +/-   ##
=======================================
  Coverage   87.51%   87.51%           
=======================================
  Files          55       55           
  Lines        5887     5887           
  Branches     1394     1394           
=======================================
  Hits         5152     5152           
  Misses        466      466           
  Partials      269      269           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Benchmark results

Before this PR: 323.6 thousand lines per second
After this PR: 311.7 thousand lines per second

Measured change: 3.69% slower (4.56% slower to 1.14% slower)
Summary: Probably slower

@alangpierce alangpierce merged commit e147008 into main Oct 7, 2022
@alangpierce alangpierce deleted the jest-integration-esm-support branch October 7, 2022 07:31
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.

"Must use import to load ES Module" when trying to use ES module in Jest
1 participant