Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Jul 29, 2025

PR Checklist

Overview

Adds in a special-case try/catch -> throw. If the file being imported is a .cts, .mts, or .ts and the caught error from import() is for an unknown file extension, we know it's from a Node.js version that doesn't support those file extensions. In that case we'll want to throw the original informative require() error per #5393.

💖

@JoshuaKGoldberg JoshuaKGoldberg changed the title fix: use original require() error if ERR_UNKNOWN_FILE_EXTENSION fix: use original require() error for TS files if ERR_UNKNOWN_FILE_EXTENSION Jul 29, 2025
@JoshuaKGoldberg JoshuaKGoldberg added the status: blocked Waiting for something else to be resolved label Aug 5, 2025
@JoshuaKGoldberg JoshuaKGoldberg removed the status: blocked Waiting for something else to be resolved label Sep 1, 2025
@JoshuaKGoldberg
Copy link
Member Author

cc @mark-wiemer - none of the test failures are unique to this PR. I filed #5467.

@JoshuaKGoldberg JoshuaKGoldberg merged commit ebdbc48 into mochajs:main Sep 30, 2025
89 of 93 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the require-module-syntax-throw branch September 30, 2025 13:58
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.

🐛 Bug: original require() errors are masked with an unrelated ERR_UNKNOWN_FILE_EXTENSION

2 participants