From dd9b51d68b994a3447adad60883065113d0be157 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Thu, 4 Feb 2021 06:23:47 -0800 Subject: [PATCH] chore: friendlier install failure message (#5281) --- src/cli/cli.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 00199bf878..a80cda797b 100755 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -130,6 +130,13 @@ program .command('install [browserType...]') .description('Ensure browsers necessary for this version of Playwright are installed') .action(function(browserType) { + const allBrowsers = new Set(['chromium', 'firefox', 'webkit']); + for (const type of browserType) { + if (!allBrowsers.has(type)) { + console.log(`Invalid browser name: '${type}'. Expecting 'chromium', 'firefox' or 'webkit'.`); + process.exit(1); + } + } installBrowsers(browserType.length ? browserType : undefined).catch((e: any) => { console.log(`Failed to install browsers\n${e}`); process.exit(1);