23 Jan, 2018

Jest testing useful commands

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 notes:

  • 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: