Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(cli): do not suggest internal tools in `install` command (#7437)

Dmitry Gozman040d81052a2f
diff --git a/src/cli/cli.ts b/src/cli/cli.ts
index d600a9269a..cf8cc65758 100755
--- a/src/cli/cli.ts
+++ b/src/cli/cli.ts
@@ -39,6 +39,7 @@ const SCRIPTS_DIRECTORY = path.join(__dirname, '..', '..', 'bin');
type BrowserChannel = 'chrome-beta'|'chrome'|'msedge';
const allBrowserChannels: Set<BrowserChannel> = new Set(['chrome-beta', 'chrome', 'msedge']);
+const suggestedBrowsersToInstall = ['chromium', 'webkit', 'firefox', ...allBrowserChannels].map(name => `'${name}'`).join(', ');
const packageJSON = require('../../package.json');
const ChannelName = {
@@ -125,7 +126,7 @@ program
const browserChannels: Set<BrowserChannel> = new Set(args.filter((browser: any) => allBrowserChannels.has(browser)));
const faultyArguments: string[] = args.filter((browser: any) => !browserNames.has(browser) && !browserChannels.has(browser));
if (faultyArguments.length) {
- console.log(`Invalid installation targets: ${faultyArguments.map(name => `'${name}'`).join(', ')}. Expecting one of: ${[...allBrowserNames, ...allBrowserChannels].map(name => `'${name}'`).join(', ')}`);
+ console.log(`Invalid installation targets: ${faultyArguments.map(name => `'${name}'`).join(', ')}. Expecting one of: ${suggestedBrowsersToInstall}`);
process.exit(1);
}
if (browserNames.has('chromium') || browserChannels.has('chrome-beta') || browserChannels.has('chrome') || browserChannels.has('msedge'))
@@ -145,7 +146,7 @@ program
console.log(` Install default browsers.`);
console.log(``);
console.log(` - $ install chrome firefox`);
- console.log(` Install custom browsers, supports ${[...allBrowserNames, ...allBrowserChannels].map(name => `'${name}'`).join(', ')}.`);
+ console.log(` Install custom browsers, supports ${suggestedBrowsersToInstall}.`);
});
async function installBrowserChannel(channel: BrowserChannel) {