chore: friendlier install failure message (#5281)
This commit is contained in:
parent
3126fee780
commit
dd9b51d68b
|
|
@ -130,6 +130,13 @@ program
|
||||||
.command('install [browserType...]')
|
.command('install [browserType...]')
|
||||||
.description('Ensure browsers necessary for this version of Playwright are installed')
|
.description('Ensure browsers necessary for this version of Playwright are installed')
|
||||||
.action(function(browserType) {
|
.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) => {
|
installBrowsers(browserType.length ? browserType : undefined).catch((e: any) => {
|
||||||
console.log(`Failed to install browsers\n${e}`);
|
console.log(`Failed to install browsers\n${e}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue