// Checks the chess page (web/static/chess): the rules helpers, the UCI lines it sends, and the real Stockfish file answering them. // node tests/chess/game_test.mjs import fs from 'node:fs'; import { spawn } from 'node:child_process'; import { pathToFileURL, fileURLToPath } from 'node:url'; import path from 'node:path'; const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'web', 'static', 'chess'); const g = await import(pathToFileURL(path.join(root, 'game.js')).href); let failed = 0; const ok = (n, v) => { console.log(v ? 'ok ' : 'FAIL', n); if (!v) failed++; }; // ---- the page ---- const html = fs.readFileSync(path.join(root, 'index.html'), 'utf8'); const script = html.match(/