Node js in 2023 - What’s New in the Node.js Native Test Runner
summary
Node.js now ships a native test runner, stable and backported to Node 18 LTS, that claims 10x faster than Jest by using internal async tracing via AsyncLocalStorage-based tracing and TAP output with built-in reporters (spec, tap, junit). It provides per-test mock contexts that auto-reset, a fake-timers implementation using a priority-queue for much faster time advancement, experimental test coverage via --experimental-test-coverage, file-level parallelization, abortable network requests, and tips for finding leaked handles.
AI-written summary · about
chapters (17)
- 0:00Introduction and motivation
- 1:04History of Node.js test runner
- 2:53Why native test runner
- 6:08Recreating test runner from scratch
- 7:57Async local storage tracking
- 10:53Stable release and TAP protocol
- 11:39Snapshot testing evolution
- 13:02Mocking with new API
- 14:50Fake timers implementation
- 18:45Request aborting and reporters
- 20:31Code coverage integration
- 21:12Test sharding and concurrency
- 22:34Using protocol for cleanup
- 23:40Future discussions and retries
- 24:44Practical tips for testing
- 26:30Debugging flaky tests
- 27:57Conclusion and resources








