Exploring the test output

Right now, if we just look at the previous output without any context, it may not make a ton of sense! Let's start off by taking a look at the first line after the test, which talks about our Test Suites:

Test Suites: 1 passed, 1 total

Jest allows us to run and organize our tests in a number of different and helpful ways! For example, our tests can be run by suites; suites being larger groupings of tests. We'll explore this line of output a little further later on when we have more than a single test, but right now we only have one test suite, and thus we've only run a single test suite:

Tests: 1 passed, 1 total

We ran a single test, and that single test passed! This allows us to also keep track of what tests were run as our application code changed; we may not need to run every single test in every single suite across the board when we make minor changes! Instead, we can focus on the tests that would be affected by whatever the change was, so you may see this as being less than the total number of tests in your suites:

Snapshots: 0 total

Snapshots are a different feature entirely with Jest. Snapshots are a way to tell Jest that given input X, the rendered component should look exactly like this. We'll explore this in greater detail later! The following line indicates how long our tests took to run:

Time: 3.986s

This is important to note, as sometimes you might introduce some code to your application that makes your application incredibly slow! This can help you catch those sneaky performance-ruining bits of code in your application. Your tests will essentially be your early-warning system against poorly-performing algorithms! We will get the following output:

Ran all test suites.
Watch Usage: Press w to show more.

Finally, we get some output that tells us a little bit about what tests ran and what else we can do. We can also hit w here to get more options about what we can do with our test runner and watcher:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.144.32