1 | [![Build Status](https://travis-ci.org/stryker-mutator/stryker.svg?branch=master)](https://travis-ci.org/stryker-mutator/stryker)
|
2 | [![NPM](https://img.shields.io/npm/dm/stryker-html-reporter.svg)](https://www.npmjs.com/package/stryker-html-reporter)
|
3 | [![Node version](https://img.shields.io/node/v/stryker-html-reporter.svg)](https://img.shields.io/node/v/stryker-html-reporter.svg)
|
4 | [![Gitter](https://badges.gitter.im/stryker-mutator/stryker.svg)](https://gitter.im/stryker-mutator/stryker?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
5 |
|
6 | # Stryker HTML Reporter
|
7 |
|
8 | An HTML Reporter for the JavaScript mutation testing framework [Stryker](https://stryker-mutator.io)
|
9 |
|
10 | ## Example
|
11 |
|
12 | Click on the image below to see a real-life example of a report generated from a test run on stryker itself!
|
13 |
|
14 | [![example](https://github.com/stryker-mutator/stryker/blob/html-docs/packages/stryker-html-reporter/example.png)](https://stryker-mutator.io/stryker-html-reporter)
|
15 |
|
16 | ## Install
|
17 |
|
18 | Install stryker-html-reporter from your project folder:
|
19 |
|
20 | ```bash
|
21 | npm i --save-dev stryker-html-reporter
|
22 | ```
|
23 |
|
24 | ## Configuring
|
25 |
|
26 | You can either configure the html reporter from the `stryker.conf.js` file or from the command line. This readme describes how to do it via the config file.
|
27 |
|
28 | ### Load the plugin
|
29 |
|
30 | In order to use the `stryker-html-reporter` it must be loaded in the stryker mutation testing framework via the stryker configuration.
|
31 | Easiest is to *leave out* the `plugins` section from your config entirely. That way, all node_modules starting with `stryker-` will be loaded.
|
32 |
|
33 | If you do descide to choose specific modules, don't forget to add `'stryker-html-reporter'` to the list of plugins to load.
|
34 |
|
35 | ### Use the reporter
|
36 |
|
37 | In order to use the reporter, you must add `'html'` as single reporter or add it to the list. For example: `reporter: 'html'` or `reporter: ['html', 'progress']`.
|
38 |
|
39 | ### Options
|
40 |
|
41 | You can configure the html reporter by adding a `htmlReporter` object to your config.
|
42 |
|
43 | #### htmlReporter.baseDir
|
44 |
|
45 | Configure the base directory to write the html report to.
|
46 |
|
47 | ### Full config example
|
48 |
|
49 | ```javascript
|
50 | // stryker.conf.js
|
51 | exports = function(config){
|
52 | config.set({
|
53 | // ...
|
54 | reporter: 'html', // or ['html', 'progress'] to configure multiple reporters at once
|
55 | htmlReporter: {
|
56 | baseDir: 'reports/mutation/html' // this is the default
|
57 | },
|
58 | plugins: ['stryker-html-reporter'] // Or leave out the plugin list entirely to load all stryker-* plugins directly
|
59 | // ...
|
60 | });
|
61 | }
|
62 | ```
|
63 |
|
64 | ## Usage
|
65 |
|
66 | Use Stryker as you normally would. The report will be available where you have configured it, or in the `reports/mutation/html` as a default.
|
67 | See [https://stryker-mutator.io](https://stryker-mutator.io) for more info.
|