Skip to content

Installation and Usage

Johan Hargne edited this page Jun 26, 2018 · 8 revisions

Installation

npm install jest-html-reporter --save-dev

Usage

Configure Jest to process the test results by adding the following entry to the Jest config (jest.config.json):

"reporters": [
	"default",
	["./node_modules/jest-html-reporter", {
		"pageTitle": "Test Report"
	}]
]

As you run Jest from within the terminal, a file called test-report.html will be created within your root folder containing information about your tests.

There are multiple configuration options available. To read more about these, please refer to the configuration section.

Alternative Usage as a Test Results Processor

To run the reporter as a test results processor (after Jest is complete instead of running in parallel), add the following entry to the Jest config (jest.config.json):

{
	"testResultsProcessor": "./node_modules/jest-html-reporter"
}

Note: When running as a testResultsProcessor, the configuration needs be placed within a new file named jesthtmlreporter.config.json residing in the root folder. More information about this can be found in the configuration section.


Node Compatibility

This plugin is compatible with Node version ^4.8.3