New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stryker

Package Overview
Dependencies
Maintainers
2
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stryker

The extendable JavaScript mutation testing framework

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
776
increased by7.93%
Maintainers
2
Weekly downloads
 
Created
Source

Build Status NPM Gitter

Stryker

Stryker

Professor X: For someone who hates mutants... you certainly keep some strange company.
William Stryker: Oh, they serve their purpose... as long as they can be controlled.

Work in progress

This repository is a work in progress. We only support Jasmine tests in the browser for now. Please create and vote on issues to help us determine the priority on features.

Getting started

Stryker is a mutation testing framework for JavaScript. It allows you to test your test by temporarily inserting bugs.

To install stryker, execute the command:

npm install stryker --save-dev

Note*: During the installation you may run into errors caused by node-gyp. It is safe to ignore these errors.*

To test if stryker is working, execute the command:

node node_modules/stryker/dist/src/Stryker.js --help

Configuration

Required options

Files to mutate

Short notation: -m
Full notation: --mutate
Optional: No
Description:
A comma seperated list of globbing expressions used for selecting the files that should be mutated.
Example: -m src/**/*.js,a.js`

All files

Short notation: -f
Full notation: --files
Optional: No
Description:
A comma seperated list of globbing expressions used for selecting all files needed to run the tests. These include: test files, library files, source files (the files selected with --mutate) and any other file you need to run your tests. The order of the files specified here will be the order used to load the file in the test runner, for example: karma.
Example: -f node_modules/a-lib/**/*.js,src/**/*.js,a.js,test/**/*.js

Default config

By default, stryker requires two arguments: the source and test files.
When calling stryker with multiple source and/or test files, they have to be separated using comma's.

A basic usage of stryker is:

node node_modules/stryker/src/Stryker.js –m src/myFirstFile.js,src/mySecondFile.js –f libs/externalLibrary.js,src/myFirstFile.js,src/mySecondFile.js,test/*.js,

Supported mutations

Math

OriginalMutated
a + ba - b
a - ba + b
a * ba / b
a / ba * b
a & ba * b

Unary

OriginalMutated
a++a--
a--a++
++a--a
--a++a
+a-a
-a+a

Conditional boundary

OriginalMutated
a < ba <= b
a <= ba < b
a > ba >= b
a >= ba < b

Reverse conditional

OriginalMutated
a == ba != b
a != ba == b
a === ba !== b
a !== ba === b
a <= ba > b
a >= ba < b
a < ba >= b
a > ba <= b
a && ba || b
a || ba && b

Remove conditionals

OriginalMutated
for (var i = 0; i < 10; i++) { }for (var i = 0; false; i++) { }
while (a > b) { }while (false) { }
do { } while (a > b);do { } while (false);
if (a > b) { }if (true) { }
if (a > b) { }if (false) { }

Keywords

FAQs

Package last updated on 14 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc