GithubHelp home page GithubHelp logo

warleygabriel / mutation-tests Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 311 KB

Mutation tests example with Jest and Stryker

License: MIT License

TypeScript 62.95% JavaScript 37.05%
stryker jest typescript

mutation-tests's Introduction

mutation-tests

jest Action Status License

This project is an example of mutation tests with Stryker.
We have a simple method that returns true or false, and we create a test for this method. We have 100% code coverage, but we don't have coverage of all the scenarios.
Look at the Stryker page and get more information about it.

Getting Started

Install the dependencies:

npm install

Compile TypeScript:

npm run build

Running tests

Run tests using Jest:

npm run test
 PASS  dist/test/elections.test.js
  ✓ An 27-year-old cannot be a president (1 ms)
  ○ skipped An 35-year-old can be a president

--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line  s
--------------|---------|----------|---------|---------|-------------------
All files     |     100 |      100 |     100 |     100 |
 elections.ts |     100 |      100 |     100 |     100 |
--------------|---------|----------|---------|---------|-------------------

Running mutation tests

Run tests using Stryker:

npm run mutation:test
Ran all tests for this mutant.
Ran 1.00 tests per mutant on average.
--------------|---------|----------|-----------|------------|----------|---------|
File          | % score | killed   | timeout   | survived   | no cov   | error   |
--------------|---------|----------|-----------|------------|----------|---------|
All files     |   60.00 |        3 |         0 |          2 |        0 |       0 |
 elections.ts |   60.00 |        3 |         0 |          2 |        0 |       0 |
--------------|---------|----------|-----------|------------|----------|---------|

Note: There is a test in skip mode, if you remove this skip, we will get 100% coverage after the mutation.

Watch mode

We also have watch mode for Jest and TypeScript:

npm run build:watch
npm run test:watch

mutation-tests's People

Contributors

warleygabriel avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.