From 95b78e084d948491f50696aed9e3124f9860006d Mon Sep 17 00:00:00 2001 From: Jaromir Obr Date: Fri, 30 Jan 2026 11:55:37 +0100 Subject: [PATCH] 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 --- lib/command/info.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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}`) })