From 1da5d0cf06c7d934152d7a5d28a97c2e37bbec22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20N=C3=A9ny?= Date: Fri, 20 Nov 2026 09:30:49 +0100 Subject: [PATCH] =?UTF-8?q?Lot=20Q=20contour-dette,=20=C3=A9tape=20D=20:?= =?UTF-8?q?=20v=C3=A9los=20de=20S=20clos=20par=20constat=20;=20le=20t?= =?UTF-8?q?=C3=A9moin=20des=20positions=20trouve=20son=20Chromium?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vélos de S : à 390 × 844 (#maison), S est le dessin au trait et ses deux vélos sont dans le cadre (capture 390-S-maison) ; VELOS_TEMOIN non touché. Dette : chromium-1254, écrit en dur, a disparu du cache ; le cas du témoin se sautait sans rien dire. scripts/chromium.ts cherche CHROMIUM, sinon le plus récent du cache ; table-objets.test.ts et temoin-objets.mjs s'en servent. npm run check : 149 sur 149, 0 sauté, sans variable. Co-Authored-By: Claude Opus 5.5 --- scripts/chromium.ts | 14 ++++++++++++++ scripts/temoin-objets.mjs | 3 ++- tests/table-objets.test.ts | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 scripts/chromium.ts diff --git a/scripts/chromium.ts b/scripts/chromium.ts new file mode 100644 index 0000000..c73cf9d --- /dev/null +++ b/scripts/chromium.ts @@ -0,0 +1,14 @@ +// Le Chromium des bancs et du témoin des positions : `CHROMIUM` s'il est donné, sinon le plus récent du cache de Playwright +// (~/.cache/ms-playwright/chromium-/). Le chemin écrit en dur (chromium-1254) a disparu à une mise à jour de Playwright +// (constaté le 20/11, LOT Q-contour-dette) : le cas du témoin se sautait alors sans rien dire. +import { existsSync, readdirSync } from 'node:fs'; +import { homedir } from 'node:os'; +import { join } from 'node:path'; + +export function chromium(): string { + if (process.env.CHROMIUM) return process.env.CHROMIUM; + const cache = join(homedir(), '.cache', 'ms-playwright'); + const n = existsSync(cache) ? readdirSync(cache).map((d) => /^chromium-(\d+)$/.exec(d)).filter(Boolean).map((m) => +m![1]!).sort((a, b) => b - a) : []; + for (const v of n) { const exe = join(cache, `chromium-${v}`, 'chrome-linux64', 'chrome'); if (existsSync(exe)) return exe; } + return join(cache, 'chromium-introuvable', 'chrome'); +} diff --git a/scripts/temoin-objets.mjs b/scripts/temoin-objets.mjs index 8b1ec30..1de0471 100644 --- a/scripts/temoin-objets.mjs +++ b/scripts/temoin-objets.mjs @@ -11,10 +11,11 @@ import { readFileSync, writeFileSync } from 'node:fs'; import { spawn, execSync } from 'node:child_process'; import { fileURLToPath } from 'node:url'; import { comparerReleves } from '../maquette/temoin.ts'; +import { chromium as cheminChromium } from './chromium.ts'; const require = createRequire(process.env.PW_CORE || '/home/julesneny8/.npm/_npx/9833c18b2d85bc59/node_modules/'); const { chromium } = require('playwright-core'); -const EXE = process.env.CHROMIUM || '/home/julesneny8/.cache/ms-playwright/chromium-1254/chrome-linux64/chrome'; +const EXE = cheminChromium(); const args = process.argv.slice(2), opt = (k) => { const i = args.indexOf(k); return i < 0 ? null : args[i + 1]; }; const racine = fileURLToPath(new URL('..', import.meta.url)), TEMOIN = `${racine}tests/temoin-objets.json`; diff --git a/tests/table-objets.test.ts b/tests/table-objets.test.ts index eab466a..6a18697 100644 --- a/tests/table-objets.test.ts +++ b/tests/table-objets.test.ts @@ -6,12 +6,13 @@ import { readFileSync, existsSync } from 'node:fs'; import { spawnSync } from 'node:child_process'; import { lireFiches, lireObjets } from '../scripts/contenu.ts'; import { comparerReleves } from '../maquette/temoin.ts'; +import { chromium } from '../scripts/chromium.ts'; const lire = (p: string) => readFileSync(new URL(`../${p}`, import.meta.url), 'utf8'); const TEMOIN = JSON.parse(lire('tests/temoin-objets.json')); const CHAP = lireFiches(lire('content/fiches.md')), MD = lire('content/objets.md'); const fiches = new Set(CHAP.flatMap((c) => c.fiches.map((f) => f.id))); -const CHROMIUM = process.env.CHROMIUM || '/home/julesneny8/.cache/ms-playwright/chromium-1254/chrome-linux64/chrome'; +const CHROMIUM = chromium(); test('témoin : figé, complet (démo et mode fond), chaque objet nommé par une fiche qui existe', () => { for (const k of ['demo', 'fond']) {