Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/playwright-core/src/cli/installActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function markDockerImage(dockerImageNameTemplate: string) {
await writeDockerVersion(dockerImageNameTemplate);
}

export async function installBrowsers(args: string[], options: { withDeps?: boolean, force?: boolean, dryRun?: boolean, list?: boolean, shell?: boolean, noShell?: boolean, onlyShell?: boolean, progress?: boolean, remove?: boolean }) {
export async function installBrowsers(args: string[], options: { withDeps?: boolean, force?: boolean, dryRun?: boolean, list?: boolean, shell?: boolean, onlyShell?: boolean, progress?: boolean, remove?: boolean }) {
if (options.progress === false)
process.env.PLAYWRIGHT_DOWNLOAD_NO_PROGRESS = '1';
if (isLikelyNpxGlobal()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/cli/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function decorateProgram(program: Command) {
.option('--no-shell', 'do not install chromium headless shell')
.option('--no-progress', 'do not show download progress bars')
.option('--no-remove', 'do not remove unused browsers')
.action(async function(args: string[], options: { withDeps?: boolean, force?: boolean, dryRun?: boolean, list?: boolean, shell?: boolean, noShell?: boolean, onlyShell?: boolean, progress?: boolean, remove?: boolean }) {
.action(async function(args: string[], options: { withDeps?: boolean, force?: boolean, dryRun?: boolean, list?: boolean, shell?: boolean, onlyShell?: boolean, progress?: boolean, remove?: boolean }) {
try {
await installBrowsers(args, options);
} catch (e) {
Expand Down
8 changes: 6 additions & 2 deletions packages/playwright-core/src/tools/cli-client/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,12 @@ function validateFlags(args: MinimistArgs, command: { flags: Record<string, 'boo
continue;
if ((globalOptions as readonly string[]).includes(key))
continue;
if (!(key in command.flags))
unknownFlags.push(key);
if (key in command.flags)
continue;
// Negated flags like '--no-shell' are parsed as { shell: false }.
if (args[key] === false && `no-${key}` in command.flags)
continue;
unknownFlags.push(key);
}
if (unknownFlags.length)
output.errorUnknownOption(unknownFlags, command.help);
Expand Down
10 changes: 10 additions & 0 deletions tests/mcp/cli-misc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ test('install-browser', async ({ cli, server, mcpBrowser }) => {
expect(output).toMatch(/chromium-\d+/);
});

test('install-browser --no-shell', async ({ cli }) => {
const withShell = await cli('install-browser', 'chromium', '--dry-run');
expect(withShell.exitCode).toBe(0);
expect(withShell.output).toContain('chromium-headless-shell');
const noShell = await cli('install-browser', 'chromium', '--no-shell', '--dry-run');
expect(noShell.exitCode).toBe(0);
expect(noShell.output).toMatch(/chromium v\d+/);
expect(noShell.output).not.toContain('chromium-headless-shell');
});

test('install workspace', async ({ cli }, testInfo) => {
const { output } = await cli('install');
expect(output).toContain(`Workspace initialized at`);
Expand Down
Loading