sajad torkamani

Using jest


jest --watch <test-file-pattern>


jest --watch userService.spec.ts

This will watch userService.spec.ts for changes and re-run the tests related to that file.

Using NPM script

Assuming you have a test:watch NPM script that looks like this:

  // other NPM scripts
  "test:watch": "jest --watch"

You can run

npm run test:watch -- <test-file-name>


Tagged: Jest

Leave a comment

Your email address will not be published. Required fields are marked *