Skip to content

Commit ecb279a

Browse files
johnjenkinsJohn Jenkins
andauthored
fix(testing): puppeteer <= 22 executable path (#6478)
* fix(testing): puppeteer <= 22 executable path * chore: --------- Co-authored-by: John Jenkins <john.jenkins@nanoporetech.com>
1 parent e678159 commit ecb279a

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/testing/puppeteer/puppeteer-browser.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,16 @@ export async function startPuppeteerBrowser(config: ValidatedConfig) {
6767
devtools: config.testing.browserDevtools,
6868
...connectOpts,
6969
};
70-
launchOpts.executablePath =
71-
process.env.PUPPETEER_EXECUTABLE_PATH ||
72-
process.env.CHROME_PATH ||
73-
(puppeteer.executablePath as typeof executablePath)(launchOpts);
74-
70+
try {
71+
// puppeteer >= 23
72+
launchOpts.executablePath =
73+
process.env.PUPPETEER_EXECUTABLE_PATH ||
74+
process.env.CHROME_PATH ||
75+
(puppeteer.executablePath as typeof executablePath)(launchOpts);
76+
} catch (_) {
77+
// puppeteer <= 22
78+
launchOpts.executablePath = puppeteer.executablePath(launchOpts.channel);
79+
}
7580
browser = await (puppeteer.launch as typeof launch)({ ...launchOpts });
7681
}
7782

0 commit comments

Comments
 (0)