// Runs the suite once against the reference chambers (must pass) and once per broken set (must fail).
import { spawnSync } from 'node:child_process';
import { readdirSync } from 'node:fs';
const run = (env) => spawnSync('node', ['--import', 'tsx', '--test', 'test/airlock.test.ts'], { env: { ...process.env, ...env }, encoding: 'utf8' });
const fails = (r) => Number((r.stdout.match(/^# fail (\d+)/m) || [])[1] ?? -1);
const base = run({});
console.log(`reference chambers: ${fails(base) === 0 ? 'PASS' : 'FAIL'} (${fails(base)} failing)`);
let bad = fails(base) !== 0;
for (const f of readdirSync('scripts/broken').filter((f) => f.endsWith('.ts') && f !== 'make.ts').sort()) {
const r = run({ CERBERUS_CHAMBERS: `scripts/broken/${f}` });
const n = fails(r);
console.log(`${f.replace('.ts', '').padEnd(24)} ${n > 0 ? 'caught' : 'MISSED'} (${n} failing)`);
if (!(n > 0)) bad = true;
}
process.exit(bad ? 1 : 0);
agentgate-source: code mirror on Cloudflare Pages. All repos