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

feat: export test environments as ESM #12340

Merged
merged 5 commits into from Feb 9, 2022
Merged

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 9, 2022

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

@@ -161,4 +161,4 @@ class JSDOMEnvironment implements JestEnvironment<number> {
}
}

export = JSDOMEnvironment;
export const TestEnvironment = JSDOMEnvironment;
Copy link
Member Author

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

@SimenB SimenB changed the title fix: export test environments as ESM feat: export test environments as ESM Feb 9, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #12340 (95c7782) into main (5fdbf84) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
packages/jest-environment-jsdom/src/index.ts 72.58% <100.00%> (+0.44%) ⬆️
packages/jest-environment-node/src/index.ts 68.42% <100.00%> (-2.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fdbf84...95c7782. Read the comment docs.

@SimenB SimenB merged commit 1b402ab into jestjs:main Feb 9, 2022
@SimenB SimenB deleted the test-env-export branch February 9, 2022 14:46
noseworthy added a commit to noseworthy/jest-mongodb that referenced this pull request Mar 7, 2022
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.
@github-actions
Copy link

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 Mar 12, 2022
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.

None yet

3 participants