diff --git a/doctor.mjs b/doctor.mjs index 42c8cae..165788b 100644 --- a/doctor.mjs +++ b/doctor.mjs @@ -42,21 +42,34 @@ function checkDependencies() { } async function checkPlaywright() { + // Step 1: Check if the playwright package can be imported + let chromium; + try { + const pw = await import('playwright'); + chromium = pw.chromium; + } catch { + return { + pass: false, + label: 'Playwright package not available', + fix: 'Run: npm install', + }; + } + + // Step 2: Check if the Chromium browser binary is installed try { - const { chromium } = await import('playwright'); const execPath = chromium.executablePath(); if (existsSync(execPath)) { - return { pass: true, label: 'Playwright chromium installed' }; + return { pass: true, label: `Playwright Chromium browser installed (${execPath})` }; } return { pass: false, - label: 'Playwright chromium not installed', + label: 'Playwright Chromium browser not installed', fix: 'Run: npx playwright install chromium', }; } catch { return { pass: false, - label: 'Playwright chromium not installed', + label: 'Playwright Chromium browser not installed', fix: 'Run: npx playwright install chromium', }; }