Skip to content

fix(cli): reject a wrong --wait and --json with --markdown, and send the usage to stderr - #438

Merged
nucliweb merged 1 commit into
mainfrom
fix/cli-flag-validation
Nov 14, 2026
Merged

nucliweb merged 1 commit into
mainfrom
fix/cli-flag-validation

Conversation

@nucliweb

Copy link
Copy Markdown
Owner

Summary

Stacked on #437.

Four wrong uses of the options that the CLI took without a word, all of them now a usage error with exit code 2 before the browser opens:

  • --wait abc became NaN, which the runner takes as no wait, so the snippets ran at once. --wait takes only a whole number of milliseconds.
  • --json with --markdown printed the markdown report.
  • Without a URL or --matrix, the usage went to stdout; it goes to stderr, as every other usage error. --help still prints it to stdout with exit code 0.
  • An unknown --workflow lists the workflows there are.

Test plan

  • Failing tests first: the 7 new cases of cli/tests/e2e/options.test.js.
  • npm run test:unit --prefix cli locally: 607 of 607.
  • The e2e tests that run the binary, locally (options, matrix, url-protocol, fail-on, secrets): 46 of 46. The rest of the e2e tests run in CI.
  • npm run lint locally.
  • The real CLI with each wrong use: exit code 2, nothing in stdout and the message in stderr.

…the usage to stderr

--wait with a value that is not a number, such as "abc", became NaN, which the runner takes as no wait: the snippets ran at once and nothing said so. It takes only a whole number of milliseconds, and anything else exits with 2 before the browser opens.

--json with --markdown printed the markdown report; it is a usage error. Without a URL or --matrix, the usage went to stdout with exit code 2; it goes to stderr, as every other usage error. An unknown workflow lists the ones there are.
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
webperf-snippets Ready Ready Preview Nov 14, 2026 9:32pm UTC

Base automatically changed from fix/cli-unsupported-output to main November 14, 2026 21:41
@nucliweb
nucliweb merged commit 253115c into main Nov 14, 2026
17 of 18 checks passed
@nucliweb
nucliweb deleted the fix/cli-flag-validation branch November 14, 2026 21:44

This branch was successfully deployed

1 active deployment
Preview — 8e353070 Deployed Nov 14, 2026 by vercel[bot]
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