Jest JSON Reporter

1.2.2 · active · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

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

view raw JSON →