Skip to content

fix: allow importing ESM interface and reporters - #5563

Merged
mark-wiemer merged 3 commits into
mochajs:mainfrom
Lightning00Blade:fix-import-from-esm
Dec 31, 2025
Merged

mark-wiemer merged 3 commits into
mochajs:mainfrom
Lightning00Blade:fix-import-from-esm

Conversation

@Lightning00Blade

@Lightning00Blade Lightning00Blade commented Dec 3, 2025 •

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

A very simple (and rough) PR to show case where the issue is. It only unwraps modules default if present.

@mark-wiemer
mark-wiemer marked this pull request as draft December 4, 2025 01:37
@mark-wiemer

Copy link
Copy Markdown
Member

Thanks @Lightning00Blade , can you add a unit test that would've failed before but passes with your code changes?

@Lightning00Blade
Lightning00Blade marked this pull request as ready for review December 17, 2025 12:03
Comment thread .github/release-please/manifest.json Resolved
@Lightning00Blade

Copy link
Copy Markdown
Contributor Author

@mark-wiemer I added the requested tests verified they don't pass on main.

I also strongly want to emphasize that PR #5344 should be merged as well,
even without test as where this bug was happening was easier once I had similar patch applied to the one proposed in the PR.

@codecov

codecov Bot commented Dec 17, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (9cc3ada) to head (e6c338e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5563   +/-   ##
=======================================
  Coverage   93.52%   93.53%           
=======================================
  Files          57       57           
  Lines        4465     4469    +4     
  Branches      918      920    +2     
=======================================
+ Hits         4176     4180    +4     
  Misses        289      289           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super. I verified locally that this passes with the repro case in #5562 (comment). Just one more test and I think we'll be good to go! 🚀

Comment thread lib/mocha.js Resolved
@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author waiting on response from OP or other posters - more information needed label Dec 17, 2025
@mark-wiemer mark-wiemer added status: needs review a maintainer should (re-)review this pull request and removed status: waiting for author waiting on response from OP or other posters - more information needed labels Dec 20, 2025

@mark-wiemer mark-wiemer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me, waiting for @JoshuaKGoldberg to review and merge :) Thank you!

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 lgtm, thanks!

@mark-wiemer
mark-wiemer merged commit bc9fc84 into mochajs:main Dec 31, 2025
80 checks passed
@mark-wiemer mark-wiemer removed the status: needs review a maintainer should (re-)review this pull request label Dec 31, 2025
lennonnikolas pushed a commit to lennonnikolas/mocha that referenced this pull request Jan 24, 2026
* fix allow importing ESM reporter and

* add test
@mostafaNazari702 mostafaNazari702 mentioned this pull request Aug 9, 2026
3 tasks done
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: Can't ESM (default) import custom interfaces and reporters

3 participants