{"id":13373,"library":"jest-html-reporter","title":"Jest HTML Reporter","description":"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.","status":"active","version":"4.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/Hargne/jest-html-reporter","tags":["javascript","jest","html","reporter","report","plugin"],"install":[{"cmd":"npm install jest-html-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add jest-html-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add jest-html-reporter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency as it functions as a Jest test results processor/reporter.","package":"jest","optional":false}],"imports":[{"note":"The reporter is configured as a string path within Jest's `reporters` array in `jest.config.json`, optionally with an options object. It is not directly imported into JavaScript/TypeScript files.","wrong":"import { JestHtmlReporter } from 'jest-html-reporter';","symbol":"Reporter configuration for 'reporters' array","correct":"[\"./node_modules/jest-html-reporter\", { \"outputPath\": \"./test-report.html\", \"pageTitle\": \"My Report\" }]"},{"note":"When used as a `testResultsProcessor` in `jest.config.json`, the reporter is referenced by its module path. Configuration options for this mode must be placed in `jesthtmlreporter.config.json` or under the `jest-html-reporter` key in `package.json`.","wrong":"require('jest-html-reporter');","symbol":"Processor configuration for 'testResultsProcessor'","correct":"\"./node_modules/jest-html-reporter\""},{"note":"This package is a Jest plugin and is not designed for direct module import into user application code. It is loaded and executed exclusively by the Jest test runner based on its configuration.","wrong":"import JestHtmlReporter from 'jest-html-reporter'; // or const reporter = require('jest-html-reporter');","symbol":"Direct module import (incorrect)","correct":"(Configure in `jest.config.json` as shown above)"}],"quickstart":{"code":"{\n  \"testEnvironment\": \"node\",\n  \"reporters\": [\n    \"default\",\n    [\n      \"./node_modules/jest-html-reporter\",\n      {\n        \"outputPath\": \"./test-report.html\",\n        \"pageTitle\": \"My Project Test Report\",\n        \"darkTheme\": true,\n        \"includeStackTrace\": true,\n        \"additionalInformation\": [\n          { \"label\": \"Project\", \"value\": \"My Awesome App\" },\n          { \"label\": \"Environment\", \"value\": process.env.NODE_ENV ?? \"development\" }\n        ]\n      }\n    ]\n  ]\n}","lang":"json","description":"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."},"warnings":[{"fix":"Update any environment variables referencing the old name to `JEST_HTML_REPORTER_STATUS_IGNORE_FILTER`.","message":"The environment variable for status filtering was renamed from `JEST_HTML_REPORTER_STATUS_FILTER` to `JEST_HTML_REPORTER_STATUS_IGNORE_FILTER`.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"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.","message":"Configuration options for `jest-html-reporter` differ based on whether it's used as a `reporter` (in the `reporters` array) or a `testResultsProcessor`.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"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.","message":"As of v4.3.1, using invalid configuration keys will trigger an alert in the console during Jest execution.","severity":"gotcha","affected_versions":">=4.3.1"},{"fix":"If you rely on console log origins being hidden by default, explicitly set `hideConsoleLogOrigin: true` in your configuration to maintain the desired behavior.","message":"The documented default value for `hideConsoleLogOrigin` was corrected to `false` in v4.3.1, meaning console log origins are shown by default.","severity":"gotcha","affected_versions":">=4.3.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"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.","cause":"The package `jest-html-reporter` is either not installed or the path specified in `jest.config.json` is incorrect.","error":"Jest HTML Reporter: Cannot find module './node_modules/jest-html-reporter' from 'jest.config.json'"},{"fix":"Check the `jest-html-reporter` documentation for the correct spelling and available configuration options. For example, change `'outputDir'` to `'outputPath'`.","cause":"A configuration option used in your reporter setup is not recognized or is misspelled. The actual option for output directory is `outputPath`.","error":"Jest HTML Reporter: Invalid configuration key found: 'outputDir'"},{"fix":"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).","cause":"This can occur if the reporter is configured without an options object when used in the `reporters` array, but the reporter expects one, or if an option value is of the wrong type.","error":"TypeError: Cannot read properties of undefined (reading 'length') in jest-html-reporter"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}