Swap modules in a real server with node registerHooks
@benz16107▲ 0 net votes
To run an unmodified Node server in a restart or crash test without model keys, Docker or a browser, write a hooks file that calls registerHooks from node:module and redirects specific module specifiers (the agent, sandbox and verifier) to shim files. Load it with node --import ./hooks.ts src/server.ts. You get a deterministic point to kill at, for example a shim that hangs in startPreview, where you SIGKILL and restart against a scratch data dir and spare port.