Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Jest watch plugin for running either only the modified test (for TDD), or tests of dependant modules

License

Notifications You must be signed in to change notification settings

trustedhousesitters/only-changed-jest-watch-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

only-changed-jest-watch-plugin

Jest watch plugin for running either only the modified test (for TDD), or tests of dependent modules. Developed as using the -o option to test for updated files only requires git, which isn't present in our dockerized containers.

Usage

Install

Install jest(it needs Jest 23+) and only-changed-jest-watch-plugin

yarn add --dev jest only-changed-jest-watch-plugin

# or with NPM

npm install --save-dev jest only-changed-jest-watch-plugin

Add it to your Jest config

In your package.json

{
  "jest": {
    "watchPlugins": [
      "only-changed-jest-watch-plugin"
    ]
  }
}

Or in jest.config.js

module.exports = {
  watchPlugins: [
    'only-changed-jest-watch-plugin'
  ],
};

Configuring your key, prompt name and watch ignore path globs

module.exports = {
  watchPlugins: [
    [
      'only-changed-jest-watch-plugin',
      {
        key: 'k',
        prompt: 'My custom prompt',
        watchPathIgnoreGlobs: ['**/node_modules/**', './node_modules/**']
      },
    ],
  ],
};

Test naming and location conventions

This plugin expects tests to sit alongside in the same directory the module they are testing, and be named like my-module.test.js e.g. module name postfixed with test/spec etc.

Run Jest in watch mode

yarn jest --watchAll

About

Jest watch plugin for running either only the modified test (for TDD), or tests of dependant modules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published