From the course: React: Testing and Debugging
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
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.
Contents
-
-
-
-
(Locked)
Test strings with matchers3m 46s
-
(Locked)
Test numbers with matchers5m 46s
-
(Locked)
Solution: Test numbers with matchers3m 17s
-
(Locked)
Test arrays and objects with matchers7m 32s
-
(Locked)
Solution: Test object with matchers3m 8s
-
(Locked)
Code coverage reports3m 15s
-
(Locked)
Snapshot testing with Jest5m 13s
-
(Locked)
Organize your tests with describe()4m 51s
-
(Locked)
-
-
-