Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including stryker-jest-runner with all npm packages installed. Try it out:

require("jest/package.json"); // jest is a peer dependency. var strykerJestRunner = require("stryker-jest-runner")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

stryker-jest-runner v1.4.1

A plugin to use the jest test runner and framework in Stryker, the JavaScript mutation testing framework

Build Status Gitter Mutation testing badge




Install stryker-jest-runner locally within your project folder, like so:

npm i --save-dev stryker-jest-runner

Peer dependencies

The stryker-jest-runner is a plugin for Stryker to enable Jest as a test runner. As such, you should make sure you have the correct versions of its dependencies installed:

  • jest
  • stryker-api

For the minimum supported versions, see the peerDependencies section in package.json.


Configuring Stryker

Make sure you set the testRunner option to "jest" and set coverageAnalysis to "off" in your Stryker configuration.

    testRunner: 'jest'
    coverageAnalysis: 'off'

Configuring Jest

The stryker-jest-runner also provides a couple of configurable options using the jest property in your Stryker config:

    jest: {
        projectType: 'custom',
        config: require('path/to/your/custom/jestConfig.js'),
        enableFindRelatedTests: true,
optiondescriptiondefault valuealternative values
projectType (optional)The type of project you are working on.defaultdefault uses the config option (see below)
react when you are using create-react-app
react-ts when you are using create-react-app-typescript
config (optional)A custom Jest configuration object. You could also use require to load it here)undefined
enableFindRelatedTests (optional)Whether to run jest with the --findRelatedTests flag. When true, Jest will only run tests related to the mutated file per test. (See _--findRelatedTests_)truefalse

Note: When neither of the options are specified it will use the Jest configuration in your "package.json".
Note: the projectType option is ignored when the config option is specified. Note: Stryker currently only works for CRA-projects that have not been ejected.

The following is an example stryker.conf.js file:

module.exports = function(config) {
    testRunner: "jest",
    mutator: "javascript",
    coverageAnalysis: "off",
    mutate: ["src/**/*.js"]

For more information on what these options mean, take a look at the Stryker readme.

Loading the plugin

In order to use the stryker-jest-runner it must be loaded in the Stryker mutation testing framework via the Stryker configuration. The easiest way to achieve this, is not have a plugins section in your config file. That way, all node_modules starting with stryker- will be loaded.


Make sure to read the Stryker contribution guidelines located in the Stryker mono repository.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free