Skip to content

feat!: replace yargs with Node.js util.parseArgs - #6128

Closed
JoshuaKGoldberg wants to merge 9 commits into
mochajs:parseargs-unparser-slicefrom
JoshuaKGoldberg:remove-yargs-slice
Closed

JoshuaKGoldberg wants to merge 9 commits into
mochajs:parseargs-unparser-slicefrom
JoshuaKGoldberg:remove-yargs-slice

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

PR Checklist

Overview

Replaces yargs command dispatching with Node.js-native util.parseArgs.

Stacked on:

This PR is actually a net reduction in lines of code. Ignoring test files, the PR total is +298/-397. Combined with those two stacked PRs, the total prod lines change comes out to +673/-577. Not bad!

Behavior Changes

  • --help output is now generated by Mocha instead of yargs, so exact formatting, grouping, and wrapping may differ while preserving the same user-facing information.
  • --version / -V and --help / -h are handled before run preparation, so they print version/help output even when other options such as --require point to modules that cannot be loaded.

@JoshuaKGoldberg JoshuaKGoldberg changed the title Remove yargs from CLI command handling feat!: replace yargs with Node.js util.parseArgs Jul 1, 2026
@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review July 1, 2026 13:19
@JoshuaKGoldberg JoshuaKGoldberg added this to the v12.0.0 milestone Jul 1, 2026
Comment thread lib/cli/cli.js Resolved
Comment thread lib/cli/run.cjs Resolved

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

Cool, will review in detail for coverage later but liking the direction for sure :)

@mark-wiemer
mark-wiemer deleted the branch mochajs:parseargs-unparser-slice July 22, 2026 02:00
@mark-wiemer

Copy link
Copy Markdown
Member

ugh, see backing issue for replacement PR, this one targeted a feature branch and I didn't notice. The feature branch is gone and I'm not eager to restore it.

@mark-wiemer

mark-wiemer commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Weird, my GitHub GUI is currently wrong. The truth is that branch mochajs/mocha:parseargs-unparser-slice has been deleted, and branch JoshuaKGoldberg/mocha:remove-yargs-slice still exists. I'm not using Refined GitHub right now. Oh well.

Here is the GUI, which is incorrect:

image

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.

2 participants