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.
This commit is contained in:
1 parent
a4209fd622
commit
e4b679ad8b
1 file changed
+12
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user