The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Adding code coverage recording with Istanbul

Adding code coverage recording with Istanbul

2:57
This lesson will utilize the Istanbul tool to instrument our code for code coverage recording and reporting. We'll use this to make sure that as our library gets new features, we keep track of our coverage and can find places to improve it.
Watch this lesson now
Avatar
egghead.io

This lesson will utilize the Istanbul tool to instrument our code for code coverage recording and reporting. We'll use this to make sure that as our library gets new features, we keep track of our coverage and can find places to improve it.

Avatar
steve

Are there some further markup requirements to get Istanbul running? I am wondering this as I am attempting to work with jasmine

In reply to egghead.io
Avatar
Kent C.

I've never set up coverage with jasmine, but I assume it's fairly straightforward. A quick google search turned up this. You may also be interested in checking out nyc :-)

In reply to steve
Avatar
steve

It was not as straightforward on windows as it should have been. Ran into a couple of issues. So I switched to mocha. Thanks for nyc. I will check it out. In the case that you have split all of your tests up into different directories could you reference it like so... istanbul cover -x.test.js _mocha -- -R spec tests ? Tests is my outermost directory.

In reply to Kent C.
Avatar
Kent C.

I believe that should work. Actually, I think that test is the default directory. So if you name the directory test then you don't need to even provide a directory argument and could simply do: istanbul cover -x.test.js _mocha -- -R spec

Good luck!

In reply to steve
Avatar
calvinclaus

If you are getting:
error: No coverage information was collected, exit without writing coverage information
when running istanbul, try to install istanbul@1.0.0-alpha.2 instead, as was suggested here: https://github.com/gotwarlost/istanbul/issues/262

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?