Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Testing guide

Alexandru Buliga edited this page Jul 1, 2019 · 7 revisions

Running tests

Run tests with:

yarn test

Run tests in watch mode with:

yarn test:watch

Run single test in watch mode with:

yarn test:watch --testFilePattern=FILE_PATTERN --testNamePattern=NAME_PATTERN

or

yarn test:watch -F FILE_PATTERN -t NAME_PATTERN

Example:

yarn test:watch -F Menu -t "passes arbitrary props"

Debugging tests

  1. Open Chrome DevTools and drag & drop the whole react/ repo directory there, then click allow

screen shot 2018-09-03 at 17 19 15

  1. Go to console and run:
node --inspect-brk node_modules/.bin/jest --runInBand [PATTERN_FOR_TEST_FILENAME]

       e.g.:

node --inspect-brk node_modules/.bin/jest --runInBand ChatList*
  1. Go to Chrome DevTools and click on the green button to open Dedicated DevTools for Node.js

screen shot 2018-09-03 at 17 20 20

  1. Press Ctrl+P to navigate to your test files, add breakpoints and resume execution