Skip to content

bttmly/perturb

Repository files navigation

perturb Build Status experimental

verb

  1. make (someone) anxious or unsettled.

    "I'm perturbed about the quality of our unit tests."

  2. subject (a system, moving object, or process) to an influence tending to alter its normal or regular state or path.

    "This library perturbs our source code to check unit test strength."

Installation

yarn add --dev perturb

Stability Disclaimer

This project is in development, and should be considered experimental. It "works" -- sort of.

Usage

Assuming your project, or its compiled output, is in ./lib and you use mocha as a test framework, please try the following:

yarn add perturb
yarn run perturb -s lib -c './node_modules/.bin/mocha ./test'

About

perturb is a mutation testing framework for JavaScript projects. It helps determine the quality of unit tests.

"Mutation testing is used to design new software tests and evaluate the quality of existing software tests. Mutation testing involves modifying a program in small ways." Source

Perturb takes your source code, parses the AST, generates mutations, and runs your test suite against them. If all your tests pass when run against a mutant, you probably missed a test.

Mutation testing is different from and generally more comprehensive than code coverage metrics. Unit tests are one way way of specifying the behavior of software. If a mutation is not covered by a unit test, then that aspect of the program is unspecified.