Jest CLI Options
The jest
command line runner has a number of useful options. You can run jest --help
to view all available options. Many of the options shown below can also be used together to run tests exactly the way you want. Every one of Jest's Configuration options can also be specified through the CLI.
Here is a brief overview:
Running from the command line
Run all tests (default):
jest
Run only the tests that were specified with a pattern or filename:
jest my-test #or
jest path/to/my-test.js
Run tests related to changed files based on hg/git (uncommitted files):
jest -o
Run tests related to path/to/fileA.js
and path/to/fileB.js
:
jest --findRelatedTests path/to/fileA.js path/to/fileB.js