Skip to content

fix(cli): parse negative numbers as arguments - #42333

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42321
Aug 20, 2026
Merged

fix(cli): parse negative numbers as arguments#42333
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42321

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • playwright-cli mousewheel 0 -100 failed with Unknown options: --0, --1 because the vendored minimist sends everything matching /^-[^-]+/ down the short-flag branch. Upstream minimist has the same bug.
  • The CLI has no non-letter short flags, so match short flags on /^-[A-Za-z]/ instead and let everything else fall through to positional arguments.
  • Alternative to fix(cli): parse negative numbers as positional arguments #42324.

Fixes#42321

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Webkit quantizes wheel deltas to integers, so asserting on fractional
deltas tested the browser rather than the parser. Assert on the argument
error instead, and move the mouse into the page before scrolling.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chrome] › mcp/config.spec.ts:203 › chromiumSandbox › --sandbox enables the sandbox @mcp-ubuntu-latest-chrome

8135 passed, 1341 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a look at the latest failing CI.

🟢 No real failures — the PR is clear

The most recent run (32407110777) has a single failure, mcp/config.spec.ts:203 › chromiumSandbox › --sandbox enables the sandbox on chrome, and it's a pre-existing flake. The negative number arguments test this PR adds — which failed on WebKit in the earlier run — now passes on every browser after the fix.

Details

This PR only touches packages/playwright-core/src/tools/cli-client/minimist.ts (short-flag matching for negative-number args) plus the new cli-parsing test. The sandbox test doesn't go through CLI number parsing, so this diff can't be responsible for it.

Pre-existing flake / infra

  • [chrome] › mcp/config.spec.ts:203 › chromiumSandbox › --sandbox enables the sandbox — flaky. Across the test-results DB it fails 11 of 46 chrome runs (24%), on 4 different PRs unrelated to this one. Sandbox startup timing, not CLI parsing.

Already fixed in this PR

  • [webkit] › mcp/cli-parsing.spec.ts › negative number arguments — this failed on all three WebKit bots in the first run (32396905156), where the test asserted a fractional wheel delta WebKit doesn't deliver. The current diff drops that assertion, and the test now passes on chromium, chrome, msedge, firefox and webkit in the latest run (32403589538).

Triaged by the Playwright bot - agent run

@yury-s
Yury Semikhatsky (yury-s) merged commit c055448 into microsoft:mainAug 20, 2026
17 of 18 checks passed
Sign up for freeto 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.

[CLI]: Negative positional arguments are parsed as flags, breaking mousewheel scroll-up

2 participants

@yury-s@pavelfeldman