@wishtack/jest-tcr

0.1.2 • Public • Published

TCR Diagram

Jest-TCR: Test && Commit || Revert for JavaScript

Build Status Greenkeeper badge

What is @wishtack/jest-tcr?

@wishtack/jest-tcr is an implementation of TCR (Test && Commit || Revert) which is an idea from Oddmund Strømme.

In order to reduce code asymmetry by producing the most atomic changes to the code, every time you run the tests, TCR will commit if the tests pass and revert if they fail.

Getting Started

1. Install

with yarn

yarn add -D @wishtack/jest-tcr

with npm

npm install --dev @wishtack/jest-tcr

2. Setup

Create a dedicated jest configuration jest.config.tcr.js next to jest.config.js with the following content:

const config = require('./jest.config');

module.exports = {
  ...config,
  reporters: [
    'default',
    '@wishtack/jest-tcr'
  ]
};

3. Add this script to package.json

{
  ...
  "scripts": {
    "jest:tcr": "jest --config jest.config.tcr.js --onlyChanged"
  },
  ...
}

4. Run Jest in TCR

yarn jest:tcr

or npm run jest:tcr

5. [optional] Relaxed TCR

If you don't want to revert your spec files when tests fail, you can tell @wishtack/jest-tcr not to reset specs using the following configuration:

const config = require('./jest.config');

module.exports = {
  ...config,
  reporters: [
    'default',
    ['@wishtack/jest-tcr', {
      revertBlacklistPattern: /spec\.ts$/
    }]
  ]
};

/@wishtack/jest-tcr/

    Package Sidebar

    Install

    npm i @wishtack/jest-tcr

    Weekly Downloads

    3

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    235 kB

    Total Files

    6

    Last publish

    Collaborators

    • wishtack-admin
    • yjaaidi