jest-html-reporter is a Jest test results processor designed to generate a comprehensive HTML summary of test runs. The current stable version is 4.4.0, demonstrating active maintenance with frequent patch and minor releases. It provides a visual, interactive report that includes test status, detailed results, console logs, and stack traces, offering a more user-friendly overview than standard terminal output. Key features include extensive configuration options such as custom page titles, theme selection (including a dark theme since v4.3.0), the ability to include additional information sections, and fine-grained control over console log origins and stack trace inclusion. This reporter integrates directly into Jest's configuration, functioning either as an entry in the `reporters` array for concurrent processing or as a `testResultsProcessor` for post-run analysis. Its primary purpose is to enhance the observability and shareability of test outcomes.
npm install jest-html-reporterVerified import paths — ran on the pinned version, not inferred.
This Jest configuration snippet demonstrates how to integrate `jest-html-reporter` as a reporter. It outputs a dark-themed HTML report named `test-report.html` with a custom title, including stack traces, and additional contextual information.
Update any environment variables referencing the old name to `JEST_HTML_REPORTER_STATUS_IGNORE_FILTER`.
When using `testResultsProcessor`, place configuration in a separate file named `jesthtmlreporter.config.json` in the project root, or under the `jest-html-reporter` key in `package.json`. Direct options within `jest.config.json` are only supported for the `reporters` array.
Review your `jest.config.json` or `jesthtmlreporter.config.json` for misspelled or unsupported configuration options. Refer to the official documentation for a list of valid keys.
If you rely on console log origins being hidden by default, explicitly set `hideConsoleLogOrigin: true` in your configuration to maintain the desired behavior.
Ensure `jest-html-reporter` is installed (`npm install jest-html-reporter --save-dev` or `yarn add jest-html-reporter --dev`) and verify the module path in your Jest configuration.
Check the `jest-html-reporter` documentation for the correct spelling and available configuration options. For example, change `'outputDir'` to `'outputPath'`.
When configuring the reporter in the `reporters` array, ensure you provide an options object as the second element: `['./node_modules/jest-html-reporter', { /* options here */ }]`. Also, verify that all option values match their expected types (e.g., `outputPath` is a string).