Chapter 7. Code Coverage with Jasmine Tests

In this chapter, we will cover:

  • Configuring code coverage tools
  • Generating code coverage using karma and istanbul
  • Writing Jasmine specs for uncovered branches/code
  • Increasing code coverage for existing code

Introduction

Code coverage is used to determine which lines/pieces of code (or areas of a program) are not tested or exercised by a set of specs. Code coverage ensures the effectiveness of your specs/test suite, and not the quality of your product. However, if coverage is high (that is, between 90 percent and 100 percent), product quality will certainly be good. A program with high code coverage is tested thoroughly and has a lower chance of having production bugs as compared to a program with low code ...

Get Jasmine Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.