Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript code coverage with Jasmine [closed]

We are planning to introduce JavaScript unit testing in our project and so far Jasmine appears to be one of the better BDD unit testing frameworks for JavaScript. Now I am wondering how can we monitor code coverage of our JavaScript code. Are there any tools/plugins that we could use? We are a Microsoft shop and use .NET/MVC 4.

like image 384
user153410 Avatar asked Apr 23 '13 14:04

user153410


People also ask

Is Jasmine code coverage tool?

the actual code coverage of those tests would reveal if the application is thoroughly stressed or not. for tests written using the famous jasmine test library, an easy way to have the coverage report is via istanbul and karma .

How do you ignore code coverage?

The easiest way to exclude code from code coverage analysis is to use ExcludeFromCodeCoverage attribute. This attribute tells tooling that class or some of its members are not planned to be covered with tests. EditFormModel class shown above can be left out from code coverage by simply adding the attribute.


2 Answers

There is the Istanbul code coverage tool. And, as there is a grunt plugin for Istanbul/Jasmine it should work with Jasmine.

like image 76
Andreas Köberle Avatar answered Sep 27 '22 22:09

Andreas Köberle


A quick Googling turns up this blog post evaluating a bunch of options: Istanbul, Karma, Blanket.js, and JSCover.

For Rails, the jasmine-coverage (based on JSCoverage) gem gives you a Rake task that generates output in different formats

like image 28
alxndr Avatar answered Sep 27 '22 22:09

alxndr