// Runs the offline test suite: every dist/test/*.js except the *-live.js proofs, which need the network // (run those explicitly, e.g. `npm run test:live`). Portable: no shell globbing, works the same under cmd and sh. import { readdirSync } from 'node:fs'; import { spawnSync } from 'node:child_process'; const files = readdirSync('dist/test') .filter((f) => f.endsWith('.js') && !/-live(\.test)?\.js$/.test(f)) .map((f) => `dist/test/${f}`); if (files.length === 0) { console.error('no compiled tests in dist/test; run `npm run build` first'); process.exit(2); } const r = spawnSync(process.execPath, ['--test', ...files], { stdio: 'inherit' }); process.exit(r.status ?? 1);