/odin-typescript:nodejs-hanging-test-diagnosisfrom ODIN TypeScript
Diagnoses Node.js tests that hang after the runner reports completion. Helps identify leaked resources like open handles, timers, or connections using timeout flags and test-name-pattern isolation.
Ships in ODIN TypeScript. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Field | Bound contract |
|---|---|
| Trigger | node --test hangs, flaky tests, 'process did not exit', CI timeout after tests done, 'open handles', passes-alone-hangs-in-suite. |
| Authority | Reversible local: runs test binaries under timeouts and reporters and writes only test and teardown code in this repository; rollback is version control. No remote mutation. |
| Side effect | Runs test binaries with timeouts/reporters; edits test and teardown code. |
| Done | Isolated test passes repeatedly and the full suite exits 0; the previously leaked resource no longer keeps the process alive after the tests finish. |
timeout (Linux) or gtimeout (macOS via coreutils) (optional; if absent, interrupt the process manually).node --version. The remaining steps assume Node 24 node:test runner semantics (some flags differ on older versions). Done when: the Node version is recorded.timeout 120 node --test <file-or-directory>
If timeout exits 124, the runner did not finish before the cutoff. If the last printed lines are test results (not a current test name), the hang is after the runner finished: an active handle keeps the event loop alive. Done when: the hang is reproduced and bounded as before-summary or after-summary.--test-timeout so tests that exceed the limit fail with a name rather than hang the suite.
timeout 120 node --test --test-timeout 5000 <target>
If the hang now occurs after all named tests have reported, the leaked resource is outside the test bodies: module-level code, a hook that never completes, or a server/connection/timer left open. Done when: the hang is converted to a named failure or confirmed as post-completion.--test-force-exit.
timeout 30 node --test --test-force-exit <target>
If the previous step hung and this one exits promptly, an active handle kept the process alive. Use --test-force-exit for diagnosis only; it masks the leak, so do not ship it as the fix. Done when: the post-completion handle is confirmed or ruled out.--test-name-pattern.
timeout 60 node --test --test-name-pattern 'substring|other' <file>
For passes-alone-hangs-in-suite, run the file alone to confirm it passes, then run the suite with --test-isolation=none to expose shared-process ordering, or bisect the suite until a pair of files reproduces the interaction. Done when: the leaking test or file pair is isolated./proc/<pid>/fd to list open file descriptors (sockets, pipes, inotify, epoll, temp files).lsof -p <pid> for the same list.http.createServer().listen(), net.connect(), fs.watch(), worker_threads.Worker, child_process.spawn() without kill(), and setTimeout/setInterval without clear.
The Node node:test runner does not provide an open-handle dump; these are the available zero-dependency channels. Done when: the leaked resource is named from descriptor evidence and code review.node:test hooks at the top level and inside describe: before, after, beforeEach, and afterEach. Ensure each created resource is torn down in the matching hook. For HTTP/HTTPS keep-alive connections, await server.close() and then server.closeAllConnections() to release active sockets. For timers, use clearTimeout/clearInterval. For servers, await close(). Do not add .unref() as a fix: it only stops the handle from keeping the event loop alive, leaving the resource open. Done when: every created resource has a matching teardown in the correct hook.process.exit() in a test or hook to end the suite; it discards pending results and hides the leak. Done when: the missing teardown is added and no process.exit workaround is introduced.--test-timeout three consecutive times and confirm it passes; then run the full suite without --test-force-exit and confirm it exits 0. Done when: three consecutive isolated passes and full-suite exit 0 are confirmed./proc/lsof descriptors, and code review, stop. Report blocked with the evidence collected and state that naming the handle requires an async_hooks probe or a dedicated handle-dump tool that is not available here. Do not substitute --test-force-exit or process.exit for the missing evidence. Done when: blocked is returned with evidence, or the fix is verified.If the hang is in a dependency or native addon, return partial findings with the handle type and the code that creates it; do not widen scope to unrelated code or edit node_modules. If the hang does not reproduce in three isolation runs, report the reproduction attempts and the clean exit; do not invent a cause. If the root cause cannot be fixed, return the diagnostic report up to the last confirmed finding. If an edit worsens the result, revert all edits before returning. Do not edit production source code outside the test file unless the user explicitly confirms in the same session. A blocked result is a terminal classification naming the missing tool and the evidence that was gathered; the done predicate does not hold.
One terminal or file report: reproduction command and timeout exit code, stop point, open-descriptor observations, root cause with file and line (or blocked), fix applied (or unresolved/blocked), confirmation results.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-typescript15 skills in this plugin
/eslint-to-biome-migrationUse when migrating a JavaScript or TypeScript project from ESLint, Prettier, Standard, or mixed legacy lint configuration to Biome 2.5./fastify-inject-testingUse when asked to test Fastify applications without network sockets. Not for building the app: use fastify-schema-first-service./fastify-production-hardeningUse when asked to prepare a Fastify service for production load and exposure. Not for building the app: use fastify-schema-first-service.Other plugins' skills for the same job