Test Diagnostics
Profile every test file in the monorepo individually to find slow, hanging, or failing tests.
Quick run
Run the diagnostics script:
bash
.claude/skills/test-diagnostics/run-diagnostics.sh
Options:
- •
--timeout 30— Kill tests after N seconds (default: 30) - •
--slow-threshold 5— Report tests taking > N seconds as SLOW (default: 5) - •
--dir ./test/integration— Only test files under a specific directory
After running
- •Review the summary output
- •For any HANG tests, read the test file and look for:
- •Missing
afterAllcleanup or open connections - •Servers or background processes that aren't shut down
- •Infinite loops or unresolved promises
- •File watchers that aren't cleaned up
- •Missing
- •For any FAIL tests, run them individually with verbose output:
bash
bun test <path> 2>&1
- •For SLOW tests (>5s), check if they can be optimized:
- •Are they spawning CLI subprocesses unnecessarily?
- •Can expensive setup be shared across tests?
- •Are there unnecessary sleeps or timeouts?
- •Suggest concrete fixes for each issue found.