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

Generating code coverage using karma and istanbul


In the previous recipe, we looked at how to configure code coverage tools and associated plugins for karma. In this recipe, you will learn how to generate code coverage reports using karma and istanbul.

Getting ready

Let's configure istanbul, karma, and associated plugins for karma. For more details, refer to the previous recipe, Configuring Code Coverage tools.

You will learn how to generate code coverage reports with the help of the recipe explained in Chapter 2, Jasmine with TDD and BDD Processes. For more information, refer to the Designing the Jasmine test for existing code using TDD and BDD recipe in Chapter 2, Jasmine with TDD and BDD Processes.

How to do it...

You need to perform the following steps to generate code coverage report using istanbul and karma:

  1. First, create a myKarma.conf.js configuration file for karma in your local project's directory using the following code:

    module.exports = function(config) {
      config.set({
        basePath...