Skip to content

Commit 95b78e0

Browse files
miraoclaude
andcommitted
fix: support Playwright 1.58+ output format in codeceptjs info
Playwright 1.58 changed the output format of `npx playwright install --dry-run`: - Old format: "browser: chromium version 143.0.7499.4" - New format: "Chrome for Testing 145.0.7632.6 (playwright chromium v1208)" Updated the regex to handle both formats while excluding chromium-headless-shell. Fixes #5422 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 875a660 commit 95b78e0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/command/info.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ const { execSync } = require('child_process')
77

88
async function getPlaywrightBrowsers() {
99
try {
10-
const regex = /(chromium|firefox|webkit)\s+version\s+([\d.]+)/gi
10+
// Unified regex for both formats (excludes chromium-headless-shell):
11+
// - 1.58+: "Firefox 146.0.1 (playwright firefox v1509)"
12+
// - 1.57: "browser: firefox version 144.0.2"
13+
const regex = /(?:([\d.]+)\s+\(playwright\s+(chromium|firefox|webkit)\s)|(?:browser:\s*(chromium|firefox|webkit)\s+version\s+([\d.]+))/gi
1114
let versions = []
1215

1316
const info = execSync('npx playwright install --dry-run').toString().trim()
1417

1518
const matches = [...info.matchAll(regex)]
16-
1719
matches.forEach(match => {
18-
const browser = match[1]
19-
const version = match[2]
20+
const browser = match[2] || match[3]
21+
const version = match[1] || match[4]
2022
versions.push(`${browser}: ${version}`)
2123
})
2224

0 commit comments

Comments
 (0)