Files
buzz/beehive/test/relay-cli-fault.ts
2026-09-10 03:26:36 -04:00

12 lines
704 B
TypeScript

// Test-only module instrumentation: execute the real CLI, inject only the existing
// storage boundary. No production environment switch or copied shutdown owner.
import { registerHooks } from 'node:module';
registerHooks({ load(url, context, nextLoad) {
const loaded = nextLoad(url, context);
if (!url.endsWith('/src/relay.ts')) return loaded;
const source = String(loaded.source);
const needle = 'boundary?: SnapshotBoundary';
if (!source.includes(needle)) throw Error('Relay boundary instrumentation drift');
return { ...loaded, source: source.replace(needle, "boundary: SnapshotBoundary = async phase => { if (phase === 'directory') throw Error('injected directory fault'); }") };
} });