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

Writing Jasmine specs for uncovered branches/code


In the previous recipe, we looked at how to generate code coverage reports using karma. In this recipe, you will learn how to cover the code coverage for the uncovered branches or the code that is not being tested with the current test suite(s) in order to ensure the quality of code.

You will learn how to cover code coverage for uncovered branches/code with the help of the previous recipe, Generating code coverage using karma and istanbul and the Designing the Jasmine test for existing code using TDD and BDD recipe explained in Chapter 2, Jasmine with TDD and BDD Processes.

How to do it...

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

  1. First, you need to create a spec file (TDS_existing_coverage_spec.js) under the /spec folder and get the following code from the spec file (TDS_existing_spec.js) created during the implementation of the Designing the Jasmine test for existing code using TDD...