node-test-reporter is an opinionated, actively maintained test reporter for Node.js's built-in test runner, providing a clean, Ava-inspired output experience. Its current stable version is 1.2.0, with minor releases frequently addressing bugs and adding small features. It differentiates itself by offering enhanced error formatting for `equal` and `strictEqual` assertions via `concordance`, improved stack trace reporting, and an early error display mechanism for tests that hang due to unclosed resources. The reporter also integrates with Node.js's experimental code coverage features and provides a distinct visual style, including flipped plus/minus signs for diffs compared to the default Node.js reporter. It is designed for Node.js environments version 18 and newer, with specific recommendations for v22+ for optimal coverage reporting.
npm install node-test-reporterVerified import paths — ran on the pinned version, not inferred.
This quickstart provides runnable JavaScript test code to demonstrate passing and failing assertions, including a deep equality diff, and how to execute it with the `node-test-reporter`.
For Node.js v21+, ensure glob patterns with `**` are enclosed in single quotes. For older versions, you may need to specify the directory without globs (e.g., `src`) or use a custom globbing solution.
No direct fix if you prefer Node.js's default; this is a design choice of the reporter. Consider if this visual style aligns with your team's preferences.
It is recommended to use Node.js v22 or newer when enabling experimental test coverage (`--experimental-test-coverage`) to avoid this issue.
Ensure all resources (e.g., HTTP servers, `setInterval`, `setTimeout`) are properly closed or cleared in your test cleanup logic, especially in `after` hooks or test tear-down phases.
Upgrade your Node.js environment to version 18 or higher to use this test reporter.
Ensure `tsx` is installed (`npm install tsx -D`) and invoke Node.js with `node --import tsx --test ...` for TypeScript files.
Ensure your glob pattern is enclosed in single quotes, e.g., `node --test 'src/**/*.test.js'`. For Node.js versions older than v21, you might need to omit quotes or specify directories directly.
Use a TypeScript execution environment like `tsx` with the Node.js `--import` flag: `node --import tsx --test --enable-source-maps ...`
Review tests for unclosed resources. Ensure all servers are `close()`d, `setInterval`s are `clearInterval()`ed, and `setTimeout`s are `clearTimeout()`ed in `after` or `afterEach` hooks.