Skip to content

refactor!: replace yargs with Node.js util.parseArgs - #6164

Merged
JoshuaKGoldberg merged 15 commits into
mochajs:mainfrom
mark-wiemer:remove-yargs-slice
Jul 23, 2026
Merged

JoshuaKGoldberg merged 15 commits into
mochajs:mainfrom
mark-wiemer:remove-yargs-slice

Conversation

@mark-wiemer

@mark-wiemer mark-wiemer commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

PR Checklist

Overview

Replaces yargs command dispatching with Node.js-native util.parseArgs. Marked as a breaking change out of an abundance of caution.

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.

(Ref #6128 and #6163 for paperwork issues)

JoshuaKGoldberg and others added 13 commits June 29, 2026 09:02
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mark-wiemer
mark-wiemer marked this pull request as draft July 22, 2026 14:27
Comment thread lib/cli/run-option-metadata.cjs Resolved
Comment thread lib/cli/run-option-metadata.cjs Resolved
Comment thread lib/cli/run.cjs Resolved
Comment thread lib/cli/run.cjs Resolved
Comment thread lib/cli/run.cjs Resolved
Comment thread lib/cli/run.cjs Resolved
Comment thread lib/cli/run.cjs Resolved
Comment thread lib/cli/run.cjs Resolved
@mark-wiemer
mark-wiemer marked this pull request as ready for review July 22, 2026 15:31
@mark-wiemer
mark-wiemer marked this pull request as draft July 22, 2026 15:33
@mark-wiemer

Copy link
Copy Markdown
Member Author

(Converting back to draft while I handle some local AI-generated feedback)

@mark-wiemer
mark-wiemer marked this pull request as ready for review July 22, 2026 15:56
@mark-wiemer

Copy link
Copy Markdown
Member Author

(It was all hallucinations)

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.00000% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.90%. Comparing base (1d2bb2e) to head (0c724f3).

Files with missing lines Patch % Lines
lib/cli/cli.js 0.00% 47 Missing ⚠️
lib/cli/init.js 0.00% 5 Missing ⚠️
lib/cli/unparse-args.js 0.00% 2 Missing ⚠️
lib/cli/parse-args.js 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6164      +/-   ##
==========================================
- Coverage   82.55%   81.90%   -0.65%     
==========================================
  Files          64       64              
  Lines        4798     4864      +66     
  Branches     1074     1072       -2     
==========================================
+ Hits         3961     3984      +23     
- Misses        837      880      +43     

☔ View full report in Codecov by Harness.
📢 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.

Swell! We've both worked on this and it looks very good to me. I'm still a little nervous about edge cases in the CLI, but:

  • This area has a lot of test coverage, including some added points (IMO the coverage drop is inaccurate and misleading)
  • It's a major version that's going into RC anyway, little oddities are expected (and always fixable after the fact)

Merging now. 🚀

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.

⚡️ Performance: Mocha 12 has larger install size despite fewer dependencies

2 participants