1. Jest/Jest CLI expert
This section of The Jest Handbook is dedicated to improving your understanding of the Jest CLI (command line interface).
You will learn to:
- pass command line arguments to Jest
- use Jest to run a single test file
- ignore and run specific tests within a file using
- use Jest interactive watch mode to run a subset of your tests
What is the CLI?
Jest’s command line interface is what you see when you run commands like
npm run jest. The command that invokes Jest tends to be called
test in your npm scripts.
Jest, much like the majority of command-line programs, can be invoked with command line arguments (also known as flags). Jest has a fully-featured command line interface with utilities such as an interactive watch mode and an array of flags that can be used (use
npm run jest --help for a full list of flags).