jest-watch-exec
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

jest-watch-exec

NPM version NPM downloads

Circle CI Travis CI Codecov Coveralls Status

Greenkeeper Semantic Release

Visual Studio Code Wallaby.js

Execute commands on start or when the all tests pass.

Requires jest@23+.

Usage

To use jest-watch-exec, add it to the watchPlugins section of the Jest configuration:

{
  "jest": {
    "watchPlugins": [
      ["jest-watch-exec", { "on-start": "npm run build" }],
      // Will run test even if the script throws an error.
      ["jest-watch-exec", { "on-start": "npm run build", "on-start-ignore-error": true }],
      ["jest-watch-exec", { "on-start-script": "somescript.js" }],
      // Will run test even if the script throws an error.
      ["jest-watch-exec", { "on-start-script": "somescript.js", "on-start-ignore-error": true }],
      // Will run the `run(): boolean | Promise<boolean>` method exposed by the module
      ["jest-watch-exec", { "on-start-module": "modulescript.js" }],
      // Will run test even if the script returns:
      // - a falsy value,
      // a promise resolves to false,
      // or a rejected promise.
      ["jest-watch-exec", { "on-start-module": "modulescript.js", "on-start-ignore-error": true }],
      // execute script when there are passing tests.
      // will not execute if the tests are filtered.
      ["jest-watch-exec", { "on-pass": "npm run build" }],
      // 'exec-while-filtered' applies to 'on-pass'
      ["jest-watch-exec", { "on-pass": "npm run build", "exec-while-filtered": true }]
    ]
  }
}

Contribute

# after fork and clone 
npm install
 
# begin making changes 
git checkout -b <branch>
npm run watch
 
# after making change(s) 
git commit -m "<commit message>"
git push
 
# create PR 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.4.1
    463
    • latest

Version History

Package Sidebar

Install

npm i jest-watch-exec

Weekly Downloads

378

Version

1.4.1

License

MIT

Unpacked Size

43.4 kB

Total Files

36

Last publish

Collaborators

  • unional