1 | [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fstryker-mutator%2Fstryker%2Fmaster%3Fmodule%3Dmocha-framework)](https://dashboard.stryker-mutator.io/reports/github.com/stryker-mutator/stryker/master?module=mocha-framework)
|
2 | [![Build Status](https://github.com/stryker-mutator/stryker/workflows/CI/badge.svg)](https://github.com/stryker-mutator/stryker/actions?query=workflow%3ACI+branch%3Amaster)
|
3 | [![NPM](https://img.shields.io/npm/dm/@stryker-mutator/mocha-framework.svg)](https://www.npmjs.com/package/@stryker-mutator/mocha-framework)
|
4 | [![Node version](https://img.shields.io/node/v/@stryker-mutator/mocha-framework.svg)](https://img.shields.io/node/v/@stryker-mutator/mocha-framework.svg)
|
5 | [![Slack Chat](https://img.shields.io/badge/slack-chat-brightgreen.svg?logo=slack)](https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM)
|
6 |
|
7 | # Stryker Mocha Framework
|
8 |
|
9 | A plugin to speed up [Mocha](http://mochajs.org/) tests in [Stryker](https://stryker-mutator.io), the JavaScript mutation testing framework.
|
10 |
|
11 | This plugin makes it possible for Stryker to use `coverageAnalysis: 'perTest'`, by providing the abstraction to select which individual test(s) to run. You might also be looking for the [stryker-mocha-runner](https://www.npmjs.com/package/stryker-mocha-runner), which makes it possible to use the node-based Mocha test runner in stryker.
|
12 |
|
13 | ## Install
|
14 |
|
15 | Install @stryker-mutator/mocha-framework locally within your project folder, like so:
|
16 |
|
17 | ```bash
|
18 | npm i --save-dev @stryker-mutator/mocha-framework
|
19 | ```
|
20 |
|
21 | ## Peer dependencies
|
22 |
|
23 | The `@stryker-mutator/mocha-framework` is a plugin to use `mocha` for `stryker` as a test framework.
|
24 | As such, you should make sure you have the correct versions of its dependencies installed:
|
25 |
|
26 | * `@stryker-mutator/core`
|
27 | * `mocha`
|
28 |
|
29 | ## Configuring
|
30 |
|
31 | You can either configure the mocha test framework using the command line or by providing it in the `stryker.conf.js` file.
|
32 | This README describes how to use the `stryker.conf.js` (or `stryker.conf.json`) config file:
|
33 |
|
34 | ```javascript
|
35 | // stryker.conf.js
|
36 | module.exports = {
|
37 | // ...
|
38 | testFramework: 'mocha',
|
39 | coverageAnalysis: 'perTest'
|
40 | // ...
|
41 | }
|
42 | ```
|