Giter VIP home page Giter VIP logo

perturb's Introduction

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.

perturb's People

Contributors

bttmly avatar bywo avatar dependabot[bot] avatar

Stargazers

Roman avatar Dan Connolly avatar taichi avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

perturb's Issues

do we need filters as a top-level plugin type?

It seems like most filters are only relevant to specific mutators (e.g. the tweak-string mutator can know to avoid tweaking require("thing")) – is it necessary to have a top level filter plugin?

Since they are already supported and seem (potentially) useful probably won't remove them entirely, but all of the current filters seem like they should go into mutators.

NOTE: it may be that we want to change where filters get applied. There should probably be a way to stop recursive descent and move on if a node meets certain qualities.

consider giving MutatorPlugins some state for statistics and profiling.

// current:
const plugin: MutatorPlugin = {
  type: "mutator",
  name: "tweak-arguments",
  nodeTypes: [S.CallExpression],
  filter: util.lengthAtPropGreaterThan("arguments", 0),
  mutator: util.dropEachOfProp("arguments"),
};
// next:
export default new MutatorPlugin({
  name: "tweak-arguments",
  nodeTypes: [S.CallExpression],
  filter: util.lengthAtPropGreaterThan("arguments", 0),
  mutator: util.dropEachOfProp("arguments"),
})

what this allows is the mutator to carry some state around and do things like track how many times each gets called, how expensive its mutations are, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.