What problem does it solve?
Node test suites that run slowly or grow memory across a run are hard to diagnose without modifying test code. This Skill instruments the shared vitest node project through opt-in environment variables, producing V8 CPU profiles and heap snapshots from an existing suite with zero edits to the test file.
Core Features & Use Cases
- CPU Profiling: Set DX_PROFILE_TESTS to emit a V8 .cpuprofile via Node --cpu-prof, viewable in Chrome DevTools or speedscope to find hotspots.
- Leak Detection: Set DX_DEBUG_LEAKS to inject a setup file that captures before/after heap snapshots plus a per-test heapUsed slope in heap-samples.ndjson.
- Use Case: A suite in the echo or sdk package keeps growing in memory across tests. Run it with DX_DEBUG_LEAKS=1, read the heap slope for a monotonic rise, then diff the before/after snapshots in DevTools Comparison view to find the retainer chain holding the leaked objects.
Quick Start
Run DX_DEBUG_LEAKS=1 moon run <pkg>:test --force -- src/foo.test.ts to leak-check a single vitest suite and inspect the generated heap snapshots.