okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
a1cc285fa
main
1/** 2* Where the Chromium binary the probes drive actually lives. 3* 4* The probes launched a fixed macOS cache path, so on Windows and Linux they 5* printed "No cached Chromium found" and every runtime gate (contrast, measure, 6* luminance, motion) was skipped rather than run. Resolution is now a single 7* place with the same order everywhere: 8* 9* 1. STRATA_CHROME — an explicit override, for a CI image or a second Chrome 10* 2. the cached Playwright build (macOS, the original platforms) 11* 3. an installed browser: Chrome, Edge, Chromium 12* 13* `requireChromium` exits with the harness message the scripts already used, so 14* a machine with no browser at all still fails loudly instead of silently 15* passing a gate. 16*/ 17import { existsSync } from 'node:fs' ; 18import { join } from 'node:path' ; 19import { homedir } from 'node:os' ; 20 21const PLAYWRIGHT_MAC = [ 22join ( homedir (), 'Library/Caches/ms-playwright/chromium-1234/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing' ), 23join ( homedir (), 'Library/Caches/ms-playwright/chromium_headless_shell-1234/chrome-headless-shell-mac-arm64/chrome-headless-shell' ), 24]; 25 26const INSTALLED = [ 27// Windows 28'C:/Program Files/Google/Chrome/Application/chrome.exe' , 29'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe' , 30'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe' , 31'C:/Program Files/Microsoft/Edge/Application/msedge.exe' , 32// macOS 33'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' , 34'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge' , 35// Linux 36'/usr/bin/google-chrome' , 37'/usr/bin/google-chrome-stable' , 38'/usr/bin/chromium' , 39'/usr/bin/chromium-browser' , 40]; 41 42export function findChromium () { 43const candidates = [ process . env . STRATA_CHROME , ...PLAYWRIGHT_MAC , ...INSTALLED ]. filter ( Boolean ); 44return candidates . find (( path ) => existsSync ( path )) ?? null ; 45} 46 47export function requireChromium () { 48const path = findChromium (); 49if ( ! path ) { 50console . error ( 'No Chromium found. Set STRATA_CHROME, or install Chrome, Edge or Chromium.' ); 51process . exit ( 2 ); 52} 53return path ; 54}