From e4b679ad8b50adac4a136f17164e631326a3bdae Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Sat, 8 Aug 2026 12:17:51 +0000 Subject: [PATCH] test: find whichever Chromium build is installed The parity runner pinned one build number, so a fresh `playwright-core install chromium` left it pointing at a directory that is not there. PARITY_CHROME still overrides. --- tests/render-parity/run.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/render-parity/run.mjs b/tests/render-parity/run.mjs index 7bbbb74..88d78db 100644 --- a/tests/render-parity/run.mjs +++ b/tests/render-parity/run.mjs @@ -11,7 +11,7 @@ import { chromium } from 'playwright-core'; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = resolve(HERE, '../..'); -const CHROME = join(process.env.HOME, '.cache/ms-playwright/chromium-1228/chrome-linux/chrome'); +const CHROME = process.env.PARITY_CHROME ?? newestChromium(); const PORT = 5199; const PAGE_GAP = 20; // pageBreaks.ts const PT_MM = 25.4 / 72; @@ -19,6 +19,17 @@ const PX_MM = 25.4 / 96; const LINE_TOL_MM = 1.2; // words within this vertical span are one line const POS_TOL_MM = 1.0; // reported as a position difference beyond this +// `playwright-core install chromium` names the directory after its own build number, +// so take the highest one present. PARITY_CHROME overrides it. +function newestChromium() { + const base = join(process.env.HOME, '.cache/ms-playwright'); + const builds = (existsSync(base) ? readdirSync(base) : []) + .filter((d) => /^chromium-\d+$/.test(d)) + .sort((a, b) => +b.slice(9) - +a.slice(9)); + if (!builds.length) throw new Error('no Chromium in ~/.cache/ms-playwright — see README.md'); + return join(base, builds[0], 'chrome-linux/chrome'); +} + // ---------------------------------------------------------------- reference function loRender(file, work) {