Skip to content

chore: switch reporters from util.inherits to ES2015 classes - #5180

Merged
mark-wiemer merged 7 commits into
mochajs:mainfrom
JoshuaKGoldberg:inherits-to-class-reporters
Feb 21, 2026
Merged

mark-wiemer merged 7 commits into
mochajs:mainfrom
JoshuaKGoldberg:inherits-to-class-reporters

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Jul 20, 2024 •

Copy link
Copy Markdown
Member

PR Checklist

Overview

Switches Base, the reporters that extend from it, and class-likes in those files.

This one is more involved than the others, as existing test helpers need to be updated. The tests were previously doing some funky .call() stuff with scopes. Now they use an intermediate class to assign extensions to a new instance.

🤎

@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

Closing for now since #5025 is blocked on us being ready for a next major version. We can reopen later.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.288% (-0.07%) from 94.357%
when pulling 53c0d00 on JoshuaKGoldberg:inherits-to-class-reporters
into 579e047 on mochajs:main.

@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

Reopening now that we're working on v12 (#5357).

@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review February 3, 2026 15:30
@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as draft February 3, 2026 20:29
@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

Ah, I remember this now: the unit tests needed to be massaged quite a bit too. I'll do that.

@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review February 3, 2026 21:03
@codecov

codecov Bot commented Feb 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.72289% with 128 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.74%. Comparing base (5574738) to head (83dfcc3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lib/reporters/html.js 1.60% 123 Missing ⚠️
lib/reporters/landing.js 92.10% 3 Missing ⚠️
lib/reporters/base.js 97.61% 1 Missing ⚠️
lib/reporters/progress.js 97.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5180      +/-   ##
==========================================
- Coverage   88.89%   88.74%   -0.15%     
==========================================
  Files          66       66              
  Lines        4771     4744      -27     
  Branches      976      976              
==========================================
- Hits         4241     4210      -31     
- Misses        530      534       +4     

☔ 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.

@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.

Generally pretty good, just a couple points of confusion :)

Comment thread test/reporters/doc.spec.js Resolved
Comment thread test/reporters/xunit.spec.js Resolved
@mark-wiemer mark-wiemer added this to the v12.0.0 milestone Feb 21, 2026
@mark-wiemer mark-wiemer self-assigned this Feb 21, 2026
@mark-wiemer

Copy link
Copy Markdown
Member

Test failure is transient git issue, tests pass locally, all other tests pass, merging :)

@mark-wiemer
mark-wiemer merged commit c3f32ce into mochajs:main Feb 21, 2026
78 of 80 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Mocha Feb 21, 2026
@JoshuaKGoldberg
JoshuaKGoldberg deleted the inherits-to-class-reporters branch February 22, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants