Node.js Built-in Test Runner — Ditch Jest and Vitest for Zero-Dependency Testing
Node.js 18+ includes a native test runner. Learn how node:test replaces Jest and Vitest with zero dependencies, built-in mocking, and sub-second test runs.
1575 articles
Node.js 18+ includes a native test runner. Learn how node:test replaces Jest and Vitest with zero dependencies, built-in mocking, and sub-second test runs.
Use all CPU cores with cluster.fork() and PM2. Master sticky sessions, zero-downtime reloads, Redis for shared state, and cluster vs worker_threads tradeoffs.
Understand the 6 libuv phases, async ordering, microtask queues, and blocking detection. Debug event loop starvation and request latency spikes with --prof profiling.
Implement bulletproof shutdown. Handle SIGTERM/SIGINT, drain database connections, stop consuming messages, align with K8s termination periods, and test shutdown reliability.
Debug memory leaks systematically. Learn heap snapshots, heapdump module, Chrome DevTools analysis, WeakRef patterns, and V8 GC tuning for production stability.