JavaScript code coverage with Jasmine

44,037

Solution 1

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

Solution 2

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

Solution 3

May be a little bit late, but if test coverage is important, you can also try mocha which has a built-in support for test coverage, a good reputation too, a syntax close to jasmine and a good integration (grunt, karma, ...)

Share:
44,037

Related videos on Youtube

user153410
Author by

user153410

Updated on July 09, 2022

Comments

  • user153410
    user153410 almost 2 years

    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.

  • User 1058612
    User 1058612 over 10 years
    +1 for Mocha. I use both Jasmine and Mocha, and they do have a similar feel. Mocha + ShouldJS makes for a very flexible testing framework.
  • Jared Beck
    Jared Beck over 8 years
    For node, see Setting up Istanbul with Jasmine on NodeJS by Bryce Fisher-Fleig
  • Syed Aqeel Ashiq
    Syed Aqeel Ashiq over 6 years
    blog post is not accessible.
  • alxndr
    alxndr over 6 years
    Thanks @SyedAqeelAshiq! Fortunately the content was captured by Archive.org's Wayback Machine... web.archive.org/web/20140711015527/http://blog.johnryding.co‌​m/…