Skip to content

Conversation

Offroaders123
Copy link

PR Checklist

Overview

This is the (nearly) complete migration to the ES6 class syntax, from the original constructor function implementation.

This was originally intended to include changes for two more files, but they both were having challenges with passing tests. Those were lib/mocha.js, and lib/reporters/base.js. As they seemingly will require more formatting than simple syntax changes, I am leaving them for a separate commit.

A concern of mine:
For the goal of diff clarity, I did not perform a Prettier format step. I am happy to add a second commit, which does the formatting separately!

Related to mochajs#5025

This is the (nearly) complete migration to the ES6 class syntax, from the original constructor function implementation.

This was originally intended to include changes for two more files, but they both were having challenges with passing tests. Those were `lib/mocha.js`, and `lib/reporters/base.js`. As they seemingly will require more formatting than simple syntax changes, I am leaving them for a separate commit.
Copy link

linux-foundation-easycla bot commented Oct 6, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Member

@mark-wiemer mark-wiemer left a comment

Choose a reason for hiding this comment

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

Looks very good, just a few small comments and questions :) thanks for this and for keeping the PR focused on one core issue!

If we are no longer using the inherits package, let's see if we can remove it from the repo entirely in this PR as well (package.json, etc.)

@JoshuaKGoldberg
Copy link
Member

For the goal of diff clarity, I did not perform a Prettier format step. I am happy to add a second commit, which does the formatting separately!

Blurgh, yeah, this has been bugging me. I've been meaning to get us to a clean baseline for a while. Thanks for the reminder 😄. Sent: #5492 -> #5493.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

The source code changes look great! You've hit the right patterns IMO. Just, the test failures show there's more work to be done:

  77) XUnit reporter
       event handlers
         on 'pending', 'pass' and 'fail' events
           should add test to tests called on 'end' event:
     TypeError: Class constructor XUnit cannot be invoked without 'new'
      at Context.<anonymous> (test/reporters/xunit.spec.js:188:15)
      at callFn (lib/runnable.js:111:584)
      ...

Thanks for getting started & making so much progress on this very tedious task! 🤎

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author waiting on response from OP or other posters - more information needed label Oct 6, 2025
Offroaders123 and others added 2 commits October 8, 2025 00:08
Co-authored-by: Mark Wiemer <[email protected]>
This is a second commit to the first part, which was committed just before this. I am not completely familiar with code review yet, so I may need some more practice with things overall.

Co-authored-by: Mark Wiemer <[email protected]>
@mark-wiemer mark-wiemer removed the status: waiting for author waiting on response from OP or other posters - more information needed label Oct 12, 2025
@mark-wiemer mark-wiemer self-requested a review October 12, 2025 18:14
@mark-wiemer mark-wiemer added the semver-major implementation requires increase of "major" version number; "breaking changes" label Oct 12, 2025
Copy link
Member

@mark-wiemer mark-wiemer left a comment

Choose a reason for hiding this comment

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

Revoking approval until tests pass

@mark-wiemer mark-wiemer self-requested a review October 12, 2025 18:18
Copy link
Member

@mark-wiemer mark-wiemer left a comment

Choose a reason for hiding this comment

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

(formal approval revocation, muahahaha, hopefully tests pass this run though)

@Offroaders123
Copy link
Author

Offroaders123 commented Oct 13, 2025

Been intending to finalize the last few things here for this thread, but been a bit busy with other things as well. Going on a trip for the next few days, so I plan to finish everything once I'm back home 😃 [edit: back on Saturday]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-major implementation requires increase of "major" version number; "breaking changes"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: remove util.inherits / convert to classes

3 participants