diff --git a/lib/command/info.js b/lib/command/info.js index 05dff5bf9..79a2231dc 100644 --- a/lib/command/info.js +++ b/lib/command/info.js @@ -7,16 +7,18 @@ const { execSync } = require('child_process') async function getPlaywrightBrowsers() { try { - const regex = /(chromium|firefox|webkit)\s+version\s+([\d.]+)/gi + // Unified regex for both formats (excludes chromium-headless-shell): + // - 1.58+: "Firefox 146.0.1 (playwright firefox v1509)" + // - 1.57: "browser: firefox version 144.0.2" + const regex = /(?:([\d.]+)\s+\(playwright\s+(chromium|firefox|webkit)\s)|(?:browser:\s*(chromium|firefox|webkit)\s+version\s+([\d.]+))/gi let versions = [] const info = execSync('npx playwright install --dry-run').toString().trim() const matches = [...info.matchAll(regex)] - matches.forEach(match => { - const browser = match[1] - const version = match[2] + const browser = match[2] || match[3] + const version = match[1] || match[4] versions.push(`${browser}: ${version}`) })