From the course: React: Testing and Debugging
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Code coverage reports - React.js Tutorial
From the course: React: Testing and Debugging
Code coverage reports
- [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,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.