Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: Fix mocha in Node v22+ #4629

Merged
merged 1 commit into from
Feb 17, 2025
Merged

chore: Fix mocha in Node v22+ #4629

merged 1 commit into from
Feb 17, 2025

Conversation

rschristian
Copy link
Member

Just quick fix (that we don't need quite yet) as I noticed it.

Mocha seemingly requires an explicit "type": "commonjs" as of Node 22+, perhaps because of the new require(esm) that landed? Not quite sure.

This fixes it, in lieu of Mocha fixing something upstream (which they very well might do yet).

@coveralls
Copy link

coveralls commented Jan 10, 2025

Coverage Status

coverage: 99.618%. remained the same
when pulling f1fcf61 on chore/node-22
into 2812165 on main.

@rschristian rschristian marked this pull request as ready for review February 17, 2025 01:55
@rschristian
Copy link
Member Author

As best as I can tell, this is a change in how Node tries to determine module types.

Whereas in the past CJS was assumed here, Node now begins to read the file and guesses that this is meant to be ESM once it sees those import statements. As it's not CJS, the require hook doesn't get called and Node then fails to parse the module due to the JSX we have within.

As this is meant to be the assumed/default value, I'm really hoping nothing breaks here.

@rschristian rschristian merged commit 5aa7244 into main Feb 17, 2025
5 checks passed
@rschristian rschristian deleted the chore/node-22 branch February 17, 2025 02:00
@JoviDeCroock JoviDeCroock mentioned this pull request Feb 18, 2025
This was referenced Feb 18, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants