node-test-parser is a utility library designed to parse the output streams generated by Node.js's built-in native test runner. It provides a programmatic interface to transform raw test report streams into structured JavaScript objects, facilitating the creation of custom test reporters, analysis tools, or integration with other systems. The current stable version is 3.1.0, with regular patch and minor releases addressing dependency updates and Node.js compatibility. Major versions, such as v3.0.0, introduce significant breaking changes, primarily around Node.js runtime support. Its key differentiator lies in its specific focus and optimized parsing for the native Node.js test output, offering a streamlined approach for developers looking to extend the core Node.js testing experience without relying on external test frameworks.
npm install node-test-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a custom Node.js test reporter using `node-test-parser`. It shows how to import and use `parseReport` to consume the raw test stream and output a formatted JSON report. The example includes instructions for running tests with the custom reporter.
Upgrade your Node.js runtime environment to version 22 or newer to ensure compatibility. If an upgrade is not feasible, use `node-test-parser@2.x`.
Ensure that the input `source` stream provided to `parseReport` originates solely from `node --test` command output. For other test runners, use their specific reporting or parsing utilities.
Always pass a Node.js `Readable` stream to the `parseReport` function. If you have string data, convert it into a stream using utilities like `Readable.from()` or `new Readable()`.
Change the import statement to `import parseReport from 'node-test-parser'`.
Refactor your code to use ES Module `import` syntax (`import parseReport from 'node-test-parser'`) and ensure your environment supports ESM (e.g., set `"type": "module"` in `package.json` or use `.mjs` file extension).
Verify that `import parseReport from 'node-test-parser'` is used and that no other variable or function named `parseReport` is shadowing it.
No dependency data recorded yet.