Welcome to the world of Jest testing!
Our mission is to break you into this world gently. So let's begin...
- You will need to have access to the command-line, for Linux/Mac a Terminal or on Windows it will be a command prompt (
cmd
) - You will need to have git installed: http://git-scm.com/downloads
- NodeJS & npm - https://nodejs.org or via NVM (https://github.com/creationix/nvm)
- yarn [optional] - https://yarnpkg.com
Just use git
to clone the ssh version:
git clone git@github.com:jhbsk/jest-unit-testing-examples.git
Or use git
to clone the https version:
git clone https://github.com/jhbsk/jest-unit-testing-examples.git
Or download the .zip archive and unzip it to the folder jest-unit-testing-examples
:
https://github.com/jhbsk/jest-unit-testing-examples/archive/master.zip
On the command-line or Terminal, navigate to the root of the directory which you downloaded and run:
- If you have npm:
npm install
- If you have yarn:
yarn install
Here are a few commands you should now be able to run:
- Run Jest tests once:
npm test
oryarn test
- Run Jest in watch mode (great for TDD):
npm run test:watch
oryarn test:watch