Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 5fad3d6

Browse files
authored
feat(puppeteer): opt out on chrome stable (#343)
1 parent db1572e commit 5fad3d6

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

commands/puppeteer/src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class PuppetRunner extends Runner {
1616
this.on('forceExit', () => this.closeBrowser());
1717
}
1818

19-
async getChromeExecutablePath() {
19+
static async getChromeExecutablePath() {
2020
const installations = await chromeFinder[getPlatform()]();
2121
if (installations.length === 0) {
2222
throw new Error('Chrome not installed');
@@ -25,9 +25,6 @@ class PuppetRunner extends Runner {
2525
}
2626

2727
async launch() {
28-
if (!this.argv.chrome.executablePath) {
29-
this.argv.chrome.executablePath = await this.getChromeExecutablePath();
30-
}
3128
if (this.argv.chrome.slowMo && this.argv.chrome.slowMo > 0) {
3229
this.argv.mocha.enableTimeouts = false;
3330
}
@@ -77,6 +74,10 @@ const puppet = {
7774
handler(argv) {
7875
(async function launchAndRun() {
7976
const puppeteer = require('puppeteer-core');
77+
const launcher = require('puppeteer-core/lib/Launcher');
78+
if (!argv.chrome.executablePath) {
79+
argv.chrome.executablePath = await (argv.chrome.stable ? PuppetRunner.getChromeExecutablePath() : launcher.executablePath());
80+
}
8081
if (argv.presetEnv) {
8182
require(argv.presetEnv);
8283
}

commands/puppeteer/src/options.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ module.exports = {
2525
default: [],
2626
type: 'array',
2727
},
28+
'chrome.stable': {
29+
description: 'Use stable Chrome',
30+
default: true,
31+
type: 'boolean',
32+
},
2833
};

0 commit comments

Comments
 (0)