Lot Q contour-dette, étape D : vélos de S clos par constat ; le témoin des positions trouve son Chromium

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 <noreply@anthropic.com>
This commit is contained in:
Jules Nény
2026-11-20 09:30:49 +01:00
co-authored by Claude Opus 5.5
parent dee190026b
commit 1da5d0cf06
3 changed files with 18 additions and 2 deletions
+14
View File
@@ -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-<n>/). 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');
}
+2 -1
View File
@@ -11,10 +11,11 @@ import { readFileSync, writeFileSync } from 'node:fs';
import { spawn, execSync } from 'node:child_process'; import { spawn, execSync } from 'node:child_process';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { comparerReleves } from '../maquette/temoin.ts'; 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 require = createRequire(process.env.PW_CORE || '/home/julesneny8/.npm/_npx/9833c18b2d85bc59/node_modules/');
const { chromium } = require('playwright-core'); 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 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`; const racine = fileURLToPath(new URL('..', import.meta.url)), TEMOIN = `${racine}tests/temoin-objets.json`;
+2 -1
View File
@@ -6,12 +6,13 @@ import { readFileSync, existsSync } from 'node:fs';
import { spawnSync } from 'node:child_process'; import { spawnSync } from 'node:child_process';
import { lireFiches, lireObjets } from '../scripts/contenu.ts'; import { lireFiches, lireObjets } from '../scripts/contenu.ts';
import { comparerReleves } from '../maquette/temoin.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 lire = (p: string) => readFileSync(new URL(`../${p}`, import.meta.url), 'utf8');
const TEMOIN = JSON.parse(lire('tests/temoin-objets.json')); const TEMOIN = JSON.parse(lire('tests/temoin-objets.json'));
const CHAP = lireFiches(lire('content/fiches.md')), MD = lire('content/objets.md'); 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 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', () => { test('témoin : figé, complet (démo et mode fond), chaque objet nommé par une fiche qui existe', () => {
for (const k of ['demo', 'fond']) { for (const k of ['demo', 'fond']) {