Registry / testing / jest-json-reporter

jest-json-reporter

JSON →
library1.2.2jsnpmunverified

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-reporter
INSTALL
IMPORT
SIG · JEST-JSON-REPORTER
J
jest-json-reporter
testingjavascriptv1.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JestJSONReporterPath
"testResultsProcessor": "./node_modules/jest-json-reporter"
import reporter from 'jest-json-reporter';
jest-json-reporter is not directly imported into application code. Instead, it is configured within Jest's `package.json` or `jest.config.js` via a string path, which Jest then uses to load the CommonJS module at runtime. The 'symbol' refers to the module path itself as Jest's configuration entry point. Direct `import` or `require` in user code is not the intended usage.

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.

npm install --save-dev jest jest-json-reporter // package.json // Add the following configuration to your package.json: // { // "name": "my-project", // "version": "1.0.0", // "devDependencies": { // "jest": "^29.0.0", // "jest-json-reporter": "^1.0.0" // }, // "jest": { // "testResultsProcessor": "./node_modules/jest-json-reporter", // "testEnvironment": "node" // }, // "jestJsonReporter": { // "outputFile": "jest-test-results.json" // } // } // __tests__/example.test.ts // Create a simple test file, e.g., '__tests__/example.test.ts': describe('Basic math operations', () => { test('adds 1 + 2 to equal 3', () => { expect(1 + 2).toBe(3); }); test('multiplies 2 * 3 to equal 6', () => { expect(2 * 3).toBe(6); }); }); // Run Jest from your terminal npx jest // Verify the JSON output file // cat jest-test-results.json
Debug
Known issues
breakingMajor Jest version updates (e.g., Jest v27, v28, v29+) can sometimes introduce changes to the reporter API or how modules are resolved (e.g., ESM vs. CJS). While generally stable, ensure compatibility by testing against new Jest versions before upgrading in production.
fix
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.
affects: >=1.0.0
gotchaThe `testResultsProcessor` path in `package.json` or `jest.config.js` must be correct and resolvable from the project root. Incorrect relative paths or typos will lead to Jest failing to load the reporter.
fix
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.
affects: >=1.0.0
gotchaThe `outputFile` configuration determines where the JSON results are written. If not configured, it defaults to `test-results.json` in the project root. Using a non-unique or shared `outputFile` path across different test runs or CI stages can lead to files being overwritten.
fix
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'`.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module './node_modules/jest-json-reporter' from 'package.json'
Jest could not resolve the specified path for the test results processor, likely due to a typo, incorrect path, or the package not being installed.
fix
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`.
Jest: No tests found, exiting with error code 1
This error itself isn't directly from `jest-json-reporter`, but if Jest isn't configured correctly to find tests, the reporter won't have any results to process, leading to confusion about its operation.
fix
Ensure your Jest configuration (`testMatch`, `testRegex`) correctly identifies your test files. The `jest-json-reporter` will only output results if Jest actually runs tests.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies
jestrequiredThis package is a Jest test results processor and requires Jest to be installed as a peer dependency for its functionality.
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
jest-json-reporter — npm install jest-json-reporter · libregistry