er-00-00-05~Running Tests

InstructorKent C. Dodds

Share this video with your friends

Send Tweet

Most of the exercises do have tests and they can help through the material. You don't have to run the test if you don't want to, but they can help!

Running the tests:

npm test

This will start Jest in watch mode. You choose the file that you want using the P key on your keyboard. Read the output and play around with it.

The tests are there to help you reach the final version, however sometimes you can accomplish the task, and the tests still fail if you implement things differently than I do in my solution, so don't look to them as a complete authority.

Initially, all tests will pass, that's not what you want. You want the test to tell you that you haven't finished the exercise yet. You're going to want to disable the final import and enable the exercise file.

And that's all that you're going to need to do in the test file!

You won't want to change anything else unless you're making a pull request.

Note

Not all of the files are tested. For example, we can't test the HTML files without adding complex tooling.