INNER CODE UNIT · JavaScript
getInstalledBrowsers
sebastiancarlos/beachpatrol · .internal-scripts/postinstall.js:14
const getInstalledBrowsers = async () => {
// Parse output of `playwright install --dry-run` to get install path of browsers.
// The output has the format:
// ```
// Chrome for Testing 151.0.7922.34 (playwright chromium v1234)
// Install location: <path>
// <more info>
// <more info>
// ```
const playWrightDryInstallOutput = execSync(
"playwright install --dry-run",
).toString();
const regex = /playwright ([\w-]+) v\d+[^\n]*\n\s+Install location:\s+([^\n]*)/gm;
let match;
const locations = {};
while ((match = regex.exec(playWrightDryInstallOutput)) !== null) {
const browserName = match[1];
const installPath = match[2];