Skip to content

refactor: extract stripLeadingDashes helper + cover CLI arg-parsing edge cases#6136

Draft
mark-wiemer wants to merge 2 commits into
mochajs:parseargs-parser-slicefrom
mark-wiemer:parseargs-parser-coverage
Draft

refactor: extract stripLeadingDashes helper + cover CLI arg-parsing edge cases#6136
mark-wiemer wants to merge 2 commits into
mochajs:parseargs-parser-slicefrom
mark-wiemer:parseargs-parser-coverage

Conversation

@mark-wiemer

@mark-wiemer mark-wiemer commented Jul 4, 2026

Copy link
Copy Markdown
Member

PR Checklist

Overview

Stacked on top of #6124. Two related follow-ups to that PR:

  1. Extract a stripLeadingDashes helper dedupes flag.replace(/^--?/, "") in seven places
  2. Add unit-test coverage for arg-parsing scenarios introduced by feat!: replace yargs-parser in CLI option loading #6124 that were not previously exercised.

mark-wiemer and others added 2 commits July 4, 2026 11:00
Adds unit tests for scenarios in the new parseArgs-based CLI option
loading that were previously unexercised:

- parse-args: bare numeric positional -> UNSUPPORTED error; string and
  empty-string args input; falsy config objects skipped while merging;
  positionals merged across multiple config objects; non-boolean value
  kept for a boolean option in equals form.
- options: non-Mocha parse errors are printed and exit with code 1.

Test-only change; no production code is modified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace seven copies of `flag.replace(/^--?/, "")` across parse-args.js,
run-option-metadata.cjs, and node-flags.cjs with a single exported
`stripLeadingDashes` helper in run-option-metadata.cjs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mark-wiemer mark-wiemer changed the title test: cover CLI arg-parsing edge cases in #6124 refactor: extract stripLeadingDashes helper + cover CLI arg-parsing edge cases Jul 4, 2026
@mark-wiemer
mark-wiemer marked this pull request as draft July 4, 2026 22:34
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.

1 participant