jest-json-reporter is a utility package for Jest that processes test results and outputs them to a specified JSON file. It adheres to the JSON format defined by Jest's own documentation, making it suitable for integration into Continuous Integration (CI) pipelines, custom reporting dashboards, or any system that consumes structured test results. The package is currently at version 1.2.2 and generally operates as a 'set-and-forget' utility, meaning its release cadence is typically slow, focused on stability and compatibility with new Jest versions rather than frequent feature additions. Its key differentiator is its straightforward, minimal configuration for generating a standard JSON report, which is often preferred over more complex or opinionated reporting solutions when raw data is needed for further processing.
npm install jest-json-reporterVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install jest-json-reporter, configure it in package.json, run Jest with a basic test, and verify the generated JSON output file.
Consult the `jest-json-reporter` GitHub repository for specific version compatibility notes or open an issue if an incompatibility arises. Pin Jest versions if necessary.
Always use a path relative to your project's root (e.g., `./node_modules/jest-json-reporter`) or an absolute path. Double-check for typos.
Configure a unique `outputFile` name and path, especially in CI environments where multiple jobs might run in parallel or where results need to be archived distinctly. For example, `outputFile: 'reports/jest-results-${process.env.CI_JOB_ID || Date.now()}.json'`.Verify that `jest-json-reporter` is installed (check `node_modules` and `package.json`). Ensure the path in `testResultsProcessor` is exactly `./node_modules/jest-json-reporter`.
Ensure your Jest configuration (`testMatch`, `testRegex`) correctly identifies your test files. The `jest-json-reporter` will only output results if Jest actually runs tests.