Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/command/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
})

Expand Down