Code coverage is a report that provides a good overview of your where in your application you have tests. In this video, Emmanuel Henri sets up code coverage so you get a good understanding of which file has tests, then he updates the project to reflect the missing tests and updates the snapshots.
- [Instructor] As you build your application, … it'll be hard to track which file have tests. … And this is where a coverage report comes handy. … Let's explore where that is. … So before we do anything, I just want to remove … that test here so we can have a report … that has some failure or things that we haven't covered yet, … so I'm going to comment all this code and save it like so. … And then I'm going to go into the package.json file … and then create a brand new script. … So let's go ahead and after test, … let's go and create a brand new script, … and I'm going to call this one coverage. … And it's going to be npm run test … dash dash, and then dash dash coverage. … So this will run the test as well as the coverage, … and then let's save this. … And you can close this file if you want, … so as you can see right now, we're not doing a test … for the whole applications. … We're not taking a snapshot of the application, … so let's go and open up a terminal, … so we're going to click on terminal, new terminal. …
- Setting up for React testing and debugging
- Testing with Jest
- Snapshot testing
- Debugging with Chrome and Chrome extensions
- Optimizing React code with ESLINT
- Type checking