/* Rebuilds tests/harness.html from tests/fixture.json and the current sources. * * Everything is inlined rather than linked, so the harness renders identically * under file:// and headless screenshots, with no subresource loading rules to * worry about. Run it after any change to src/. * * node tests/build-harness.js && tests/shot.sh */ const fs = require('fs'); const path = require('path'); const root = path.join(__dirname, '..'); const read = (p) => fs.readFileSync(path.join(root, p), 'utf8'); const fixturePath = path.join(__dirname, 'fixture.json'); if (!fs.existsSync(fixturePath)) { console.error('missing tests/fixture.json — capture it with tools/make-fixture.js'); process.exit(1); } const fixture = JSON.parse(fs.readFileSync(fixturePath, 'utf8')); const vars = Object.entries(fixture.vars || {}) .map(([k, v]) => ` ${k}: ${v};`).join('\n'); const html = `