You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: let cli-client program() accept parsed arguments #43938
playwright-cli.js in microsoft/playwright-cli must know the command name before it calls program() from playwright-core/lib/tools/cli-client/program, because it checks for updates only for some commands. At the moment it finds the command with its own simple parser, and this parser can take a session name as the command (microsoft/playwright-cli#505).
microsoft/playwright-cli#521 fixes this, but it loads minimist.js and help.json from the internal files of playwright-core and copies the list of boolean options. Then program() parses the same arguments a second time.
Proposal
In packages/playwright-core/src/tools/cli-client/program.ts:
Move the minimist call and the -s → session and -g → global changes out of program() into a new exported function parseArgs(argv: string[]): MinimistArgs.
Add an optional args to the options of program(): program(options?: { args?: MinimistArgs, embedderVersion?: string }). When args is not set, program() parses process.argv.slice(2) as it does now, so the current callers continue to work.
Hi, I'm the Playwright bot. I checked the request and prepared the change.
Implemented in a fix proposal. On Linux at 17ec699e4f4760bab5ad95f6ef9b954d5f1ce7eb (1.66.0-next), the CLI entry point did not export its parser. The proposal exports parseArgs(argv) and lets program({ args }) use the result without parsing again. Existing callers keep the same behavior.
The test checks the exact -s list snapshot result, boolean options and alias normalization, then runs program() with parsed arguments. Parsing and help tests pass on Chromium, Firefox and WebKit.
Activity
github-actions commentedon Nov 5, 2026
microsoft-playwright-automation commentedon Nov 5, 2026
Hi, I'm the Playwright bot. I checked the request and prepared the change.
Implemented in a fix proposal. On Linux at
17ec699e4f4760bab5ad95f6ef9b954d5f1ce7eb(1.66.0-next), the CLI entry point did not export its parser. The proposal exportsparseArgs(argv)and letsprogram({ args })use the result without parsing again. Existing callers keep the same behavior.The test checks the exact
-s list snapshotresult, boolean options and alias normalization, then runsprogram()with parsed arguments. Parsing and help tests pass on Chromium, Firefox and WebKit.Draft PR: #43941
Triaged on Linux by the Playwright bot - agent run