Debugging the Tests

Learn how to debug tests and code when our Jest tests start to fail.

Navigating the failing tests

What do we do when a test fails?

When a test fails, one of two things is happening:

  1. Our code is not doing what we think it’s doing.

  2. Our test is not testing what we think it’s testing.

As a general rule, fix the code, not the tests. Tests should not be written to pass. They should be written to test our assumptions of how our code works and should pass because our ...