-
-
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
feat: export test environments as ESM #12340
Conversation
@@ -161,4 +161,4 @@ class JSDOMEnvironment implements JestEnvironment<number> { | |||
} | |||
} | |||
|
|||
export = JSDOMEnvironment; | |||
export const TestEnvironment = JSDOMEnvironment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for ease of use for consumers who don't wanna use default
2898136
to
c629a3f
Compare
Codecov Report
@@ Coverage Diff @@
## main #12340 +/- ##
==========================================
- Coverage 66.97% 66.96% -0.01%
==========================================
Files 329 329
Lines 17338 17335 -3
Branches 5066 5061 -5
==========================================
- Hits 11612 11609 -3
Misses 5694 5694
Partials 32 32
Continue to review full report at Codecov.
|
Jest v28 is going to start using ESM, and the latest release candidate has started exporting modules with ESM syntax: jestjs/jest#12340 This breaks jest-mongodb when importing jest-environment-node. In order to properly import this module when running in jest v28 we need to look for the default export. If the default export is present, use that, otherwise use the test environment as normal.
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. |
Summary
export =
messes with some bundling I'm looking at, so let's get rid of it.(Jest itself already handles importing test envs written as ESM (fake or not))
Test plan
Green CI