Skip to content

Commit b6f6fe0

Browse files
committed
let launcher find path
1 parent 156f3b0 commit b6f6fe0

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

src/run-lighthouse.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ import lighthouse from 'lighthouse';
22
import chromeLauncher from 'chrome-launcher';
33
import log from 'lighthouse-logger';
44

5-
// Common Chrome paths in CI environments
6-
const CI_CHROME_PATHS = [
7-
'/usr/bin/google-chrome',
8-
'/usr/bin/google-chrome-stable',
9-
];
10-
115
export const runLighthouse = async (url, settings) => {
126
let chrome;
137
try {
@@ -27,24 +21,13 @@ export const runLighthouse = async (url, settings) => {
2721
handleSIGINT: true,
2822
};
2923

30-
// In CI, Chrome might be installed in a custom location
24+
// Let chrome-launcher find Chrome in the environment
3125
if (process.env.CHROME_PATH) {
32-
console.log(`Using Chrome from: ${process.env.CHROME_PATH}`);
26+
console.log(`Using Chrome from environment: ${process.env.CHROME_PATH}`);
3327
launchOptions.chromePath = process.env.CHROME_PATH;
3428
} else {
35-
// Try common CI paths
36-
for (const path of CI_CHROME_PATHS) {
37-
try {
38-
const { execSync } = await import('child_process');
39-
execSync(`test -f ${path}`);
40-
launchOptions.chromePath = path;
41-
console.log(`Found Chrome at: ${path}`);
42-
break;
43-
} catch (e) {
44-
// Path doesn't exist, try next one
45-
continue;
46-
}
47-
}
29+
// Let chrome-launcher find Chrome automatically
30+
console.log('Letting chrome-launcher find Chrome...');
4831
}
4932

5033
chrome = await chromeLauncher.launch(launchOptions);

0 commit comments

Comments
 (0)