From the course: Angular: Workflows
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Generating code coverage reports - Angular Tutorial
From the course: Angular: Workflows
Generating code coverage reports
- One of the important things to do while testing your code is to generate code coverage reports. To do so, you can use a code coverage flag: ng test --code-coverage. What this would do is generate code coverage reports using Istanbul. Let's wait for a test to run. You can see in the file explorer, we now have a new coverage folder. Let's go ahead and open the index.html file in our browser. What you see here is a coverage report indicating the files and lines that have been tested through your spec files. Green means that we have tested the underlying code, while red means that it is untested code. It is important to know that this will only generate code coverage reports on lines of code that have run through a unit test. If you don't run a specific file through your unit test, it won't be included in the coverage report. Another quick thing to configure is to run our tests on Chrome Headless. Currently, running our test spins up an instance of Chrome. As of version 59 of Chrome…
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.