This is a working repo of the unit test workshop
Setup your machine accordingly
- Download or clone this repository and
cd
into that directory - run
yarn
to install all packages
- Run
yarn test:watchall
to run the test suite interactively. - While the test suite is running, all files named
*.test.js
recursively inside the./src/
directory are executed on each change made to a file. - If everything went right, you should see something like this:
PASS src/hiker.test.js
answer
✓ to life the universe and everything (3ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.946s
Ran all test suites.
Watch Usage
› Press o to only run tests related to changed files.
› Press p to filter by a filename regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.
yarn test
- Runns all tests and quitsyarn test:coverage
- Runns all tests and generates a coverage reportyarn test:watch
- Watch files for changes and rerun tests related to changed files.yarn test:watchall
- Same as watch, but reruns all tests when a file has changed.