包详细信息

stryker-jest-runner

stryker-mutator2.5kApache-2.0不推荐使用1.4.1

Stryker v1 is released, but you're still using an old package. This version is no longer maintained. Please use @stryker-mutator/jest-runner. See https://stryker-mutator.io/blog/2019-02-13/announcing-stryker-1-0 for the full migration guide.

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

stryker, stryker-plugin, jest, stryker-test-runner

自述文件

Build Status Gitter Mutation testing badge

Stryker

Stryker-jest-runner

Installation

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.

Configuration

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,
    }
}
option description default value alternative values
projectType (optional) The type of project you are working on. default default 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) true false

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) {
  config.set({
    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.

Contributing

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

更新日志

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.4.1 (2019-02-12)

Note: Version bump only for package stryker-jest-runner

1.4.0 (2019-02-08)

Features

  • config-editors: Remove side effects from all config editor plugins (#1317) (1f61bed)
  • mutators: Remove side effects from mutator plugins (#1352) (edaf401)
  • port: Deprecate property 'port' (#1309) (2539ee0)
  • test-frameworks: Remove side effects from all test-framework plugins (#1319) (a7160f4)
  • test-runner: Use new plugin system to load TestRunner plugins (#1361) (266247b)
  • transpilers: Remove side effects transpiler plugins (#1351) (9a8b539)

1.3.0 (2018-12-23)

Features

1.2.10 (2018-12-12)

Note: Version bump only for package stryker-jest-runner

1.2.9 (2018-11-29)

Bug Fixes

  • stryker-api: Update stryker-api peer dependency version (677fc28)

1.2.8 (2018-11-29)

Bug Fixes

  • JestTestRunner: run jest with --findRelatedTests (#1235) (5e0790e)

1.2.7 (2018-11-13)

Note: Version bump only for package stryker-jest-runner

1.2.6 (2018-11-07)

Note: Version bump only for package stryker-jest-runner

1.2.5 (2018-10-25)

Note: Version bump only for package stryker-jest-runner

1.2.4 (2018-10-15)

Bug Fixes

  • any-promise: Don't register a promise implementation (#1180) (1d3e2f6)
  • version: Version bump for failed release (8cf9e87)

1.2.2 (2018-10-03)

Bug Fixes

  • JestTestRunner: fix stryker error on skipping tests (#1168) (1f87ab1), closes #1152

1.2.1 (2018-09-14)

Note: Version bump only for package stryker-jest-runner

1.2.0 (2018-08-28)

Features

  • config: rename config setting project to projectType and 'default' to 'custom' (#1107) (4f4a9aa)

1.1.1 (2018-08-21)

Note: Version bump only for package stryker-jest-runner

1.1.0 (2018-08-19)

Features

  • stryker config: rename config setting reporter to reporters (#1088) (584218a), closes #793

1.0.4 (2018-08-17)

Bug Fixes

  • dependencies: support stryker-api 0.19.0 (#1087) (44ce923)

1.0.3 (2018-08-17)

Note: Version bump only for package stryker-jest-runner

1.0.2 (2018-08-16)

Note: Version bump only for package stryker-jest-runner

1.0.1 (2018-08-03)

Bug Fixes

  • jest-runner: Update peer dependency on Jest (7e30994)

1.0.0 (2018-07-20)

Bug Fixes

  • bail: disable bail (#36) (d29e349)
  • configuration: Allow more test file names (0a7fff9)
  • configuration: Remove test regex filter (df7dc04), closes #11
  • configuration: Remove unnecessary options (fc2799d), closes facebook/jest#2776
  • configuration: Revert removal of testPathDirs (7dea8dd)
  • Dependencies: Pin all deps on minor version (#974) (f0a7e5a), closes #954 #967
  • deps: update stryker-api dep to 0.12.0 (1831d98)
  • package.json: update stryker-api version (b3ac9bc)
  • README: Fix Travis Badge pointing to the wrong repo (bfbb754)
  • roots option: Add roots option for jest v19 (370d540)
  • stryker init: turn coverage analysis "off" (#55) (13e0697)
  • test: Fix accidentally modified test (d199206)

Chores

  • Upgrade to stryker-api 0.5 (5c5d412)

Features

  • basic-runner: Implementation of a basic Jest-runner (#4) (44a831a)
  • es2015-promise: Remove dep to es6-promise (28453a4)
  • jest-config: override jest config (#34) (e783c80)
  • Jest-runner: support jest configuration (#25) (4f83e87)
  • logging: Allow log to a file (#954) (c2f6b82), closes #748
  • node version: drop node 4 support, as Stryker did. (#47) (e939d25)
  • stryker-api: add stryker-api 0.15 support (#45) (d51d7ba)
  • typescript: Add support for create-react-app using Typescript (#48) (7cc9b86)

BREAKING CHANGES

  • typescript: Require Jest 22.x or higher. Support for 20.x and 21.x is dropped.
  • node version: Node 4 is no longer supported.
  • Upgrade to stryker-api 0.5

0.7.0 (2018-05-11)

Features

  • node version: drop node 4 support, as Stryker did. (#47) (017139d)
  • stryker-api: add stryker-api 0.15 support (#45) (94b22ab)
  • typescript: Add support for create-react-app using Typescript (#48) (e7c313d)

BREAKING CHANGES

  • typescript: Require Jest 22.x or higher. Support for 20.x and 21.x is dropped.
  • node version: Node 4 is no longer supported.

0.6.0 (2018-04-06)

Features

  • jest-config: fallback to default Jest config if it's not overridden (#42) (72b542a)

0.5.1 (2018-03-02)

Bug Fixes

0.5.0 (2018-02-23)

Features

  • jest-config: override jest config (#34) (095e366)

0.4.2 (2018-02-07)

Bug Fixes

  • package.json: update stryker-api version (7ab05e6)

0.4.1 (2018-02-07)

0.4.0 (2018-02-06)

Bug Fixes

  • deps: update stryker-api dep to 0.12.0 (3867190)
  • roots option: Add roots option for jest v19 (ec7bd35)

Features

  • Jest-runner: support jest configuration (#25) (630b60b)

0.3.0 (2017-11-03)

  • 0.3.0 (f9563b7)
  • chore(docs) Update changelog (c26f442)
  • feat(runner) Add support for Jest v21 (#21) (#22) (98ba822)
  • refactor: Add semicolon (c1d1c1c)
  • refactor(.vscode): Reset build files (5eee921)
  • refactor(test): Reset 4 tab whitespace (eeab8e1)
  • fix(roots option): Add roots option for jest v19 (ec7bd35)

0.2.2 (2017-10-23)

  • 0.2.2 (9959ee4)
  • chore(build) Don't include files in npm package that don't belong (b73430f)
  • chore(docs) Update changelog (403ff0d)
  • chore(dependencies): Update to stryker-api 0.10.0 (7fefd60)

0.2.1 (2017-09-27)

0.2.0 (2017-09-23)

  • 0.2.0 (897fbba)
  • chore(docs) Update changelog (790d317)
  • fix(test): Fix accidentally modified test (62a1785)
  • chore(dependencies): Update to stryker-api 0.9 (09e59d2)
  • chore(package-lock): Disable lock on packages (48b39b6)

0.1.0 (2017-08-14)

  • 0.1.0 (f8f798c)
  • feat(runner) Add support for Jest v20 (#16) (ad9c282)
  • chore: Upgrade to stryker-api 0.5 (7bf2c86)

BREAKING CHANGE

  • Upgrade to stryker-api 0.5

0.0.6 (2017-03-02)

  • chore: release v0.0.6 (f36f665)
  • chore: update contributors (fb17fd7)
  • fix(configuration): Allow more test file names (f54dfc3)
  • fix(configuration): Remove test regex filter (14ca864)
  • fix(configuration): Remove unnecessary options (278a754)
  • fix(configuration): Revert removal of testPathDirs (dd5de98)
  • Fix(lint): Add missing semicolon (86c6170)
  • chore(doc) Fix URLs in package.json (f718a45)
  • chore(doc) Re-create CHANGELOG.md (868cc92)

0.0.5 (2017-02-13)

  • chore: release v0.0.5 (94d9010)
  • fix(plugin) Use correct name for registering plugin (1ae61fb)
  • fix(reporting) Error messages should only be filled if there are some (8faf6c9)

0.0.4 (2017-02-10)

  • chore: release v0.0.4 (ebbbb71)
  • chore(doc) clean duplicates from changelog (ba9c278)
  • doc(readme) Mention that coverageAnalysis does not (yet) work (8b0d1bd)

0.0.3 (2017-02-10)

  • chore: add LICENSE file (72481a5)
  • chore: initial commit (aa043d6)
  • chore: release v0.0.2 (c27827d)
  • chore: release v0.0.3 (1dc606c)
  • chore: update contributors (730a93b)
  • chore: update contributors (1af92d8)
  • chore: update contributors (48bd6dc)
  • docs(readme) Update documentation and clean-up package.json (#5) (97d1661)
  • feat(basic-runner): Implementation of a basic Jest-runner (#4) (960c59d)
  • feat(es2015-promise): Remove dep to es6-promise (7f8424a)
  • fix(README): Fix Travis Badge pointing to the wrong repo (9177447)