ci: Chromium hint only when browser steps run

This commit is contained in:
CRTkafa 2026-10-12 05:10:27 +08:00
parent 44db357b73
commit c00bb0be61

View file

@ -92,7 +92,7 @@ if (quick) {
// The browser suites fall back to Google Chrome without playwright's own headless Chromium; Chrome's shutdown takes // The browser suites fall back to Google Chrome without playwright's own headless Chromium; Chrome's shutdown takes
// seconds to half a minute per browser, which makes those shards several times slower. // seconds to half a minute per browser, which makes those shards several times slower.
try { if (tasks.some(t => t.name === 'desktop boot check' || t.cmd.some(a => HEAVY.some(h => a.endsWith(h))))) try {
const { registry } = await import('playwright-core/lib/server/registry/index' as string); const { registry } = await import('playwright-core/lib/server/registry/index' as string);
const exe = registry.findExecutable('chromium-headless-shell')?.executablePath('javascript') as string | undefined; const exe = registry.findExecutable('chromium-headless-shell')?.executablePath('javascript') as string | undefined;
if (exe && !existsSync(exe)) console.log(`ci: playwright's headless Chromium is not installed (${exe.replace(homedir(), '~')}): the browser tests use Google Chrome, which is much slower to close. Install it once: bunx playwright install chromium-headless-shell`); if (exe && !existsSync(exe)) console.log(`ci: playwright's headless Chromium is not installed (${exe.replace(homedir(), '~')}): the browser tests use Google Chrome, which is much slower to close. Install it once: bunx playwright install chromium-headless-shell`);