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: always load .mjs files via import #15447

Merged
merged 6 commits into from
Jan 14, 2025

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jan 14, 2025

Summary

Since Node has gotten require(esm), we shouldn't rely on ERR_REQUIRE_ESM being thrown.

Also, require only works with no TLA, so we should also handle ERR_REQUIRE_ASYNC_MODULE

Fixes #15363 (and CI which has been broken since require(esm) was unflagged in https://nodejs.org/en/blog/release/v22.12.0)

Test plan

Added TLA to our test with .mjs config file, which fails without these code changes

Copy link

netlify bot commented Jan 14, 2025

Deploy Preview for jestjs ready!

Name Link
🔨 Latest commit 548642e
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/67867fc6b390190009bf81a9
😎 Deploy Preview https://deploy-preview-15447--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SimenB SimenB force-pushed the always-load-mjs-via-import branch from 2d6ac86 to f639a67 Compare January 14, 2025 15:04
@SimenB SimenB merged commit 43fedb5 into jestjs:main Jan 14, 2025
5 of 6 checks passed
@SimenB SimenB deleted the always-load-mjs-via-import branch January 14, 2025 15:16
@SimenB
Copy link
Member Author

SimenB commented Jan 30, 2025

Copy link

github-actions bot commented Mar 2, 2025

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 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Jest crashes on Node.js v23 when using jest.config.js contains TLA
1 participant