-
Notifications
You must be signed in to change notification settings - Fork 76
Installation and Usage
npm install jest-html-reporter --save-dev
Configure Jest to process the test results by adding the following entry to the Jest config (jest.config.js):
{
"testResultsProcessor": "./node_modules/jest-html-reporter"
}
Then when 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.
Although jest.config.js is specifically created for configuring Jest (and not this plugin), it is possible to configure Jest from within package.json by adding the following as a new line:
"jest": { "testResultsProcessor": "./node_modules/jest-html-reporter" }
It is also possible to run jest-html-reporter as a custom reporter within Jest. This allows the plugin to be run in parallel with Jest instead of after a test run, and will guarantee that the test report is generated even if Jest is run with options such as --forceExit
.
Add the following entry to the Jest config (jest.config.js):
"reporters": ["default", "./node_modules/jest-html-reporter"]
Please note that you need to add the "executionMode": "reporter"
configuration within jesthtmlreporter.config.json in order for this to work. Read more on the configuration section.
This plugin is compatible with Node version ^4.8.3