Skip to content

Commit

Permalink
chore: friendlier install failure message (#5281)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Feb 4, 2021
1 parent 3126fee commit dd9b51d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cli/cli.ts
Expand Up @@ -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);
Expand Down

0 comments on commit dd9b51d

Please sign in to comment.