Book Image

Jasmine Cookbook

By : Munish Kumar
Book Image

Jasmine Cookbook

By: Munish Kumar

Overview of this book

Table of Contents (16 chapters)
Jasmine Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Increasing code coverage for existing code


In the previous recipe, we looked at how to generate the code coverage for the uncovered branches. In this recipe, we will extend the concept to cover the uncovered branches/code and learn how to increase the code coverage for the existing JavaScript code by adding more Jasmine tests to the current test suite.

You will learn this recipe with the help of the second recipe in this chapter, Generating code coverage using karma and istanbul and the Implementing the Jasmine test corresponding to specs recipe explained in Chapter 4, Designing Specs from Requirement.

How to do it...

You need to perform the following steps to generate the code coverage report for uncovered branches/code:

  1. First, you need to create a spec file (CurrencyConverter_tests_coverage_spec.js) under the /spec folder and get the following code from the spec file (CurrencyConverter_tests_spec.js) created during the implementation of the Implementing the Jasmine test corresponding to specs...