Jest testing useful commands

Here are some commands useful with the lovely jest.

The setup, enable the jest command in the console:

npm install -g jest-cli

Run a single test with detailed output:

jest <path to the test>/<test name>.spec.js --verbose

Run tests without cache:

jest --nocache

Run tests matching a certain name and show detailed output:

jest -t '<name of the test, as specified in its definition>' --verbose

Important note: done need be used as a parameter, only of async is needed inside the test. If used, do remember to call done() at the end of the function or wherever it is needed.

Documentation:

Sources: