Making karma test coverage directory browseable

Task:
Making karma test coverage directory browseable.

Problem:
When you run test coverage report it creates a folder containing the report and a json file. However, when your connect test server starts up you see a blank screen.

0c43b69e-6872-11e3-8bd4-bb7732e53057

Solution:
Use grunt connect options to make the directory browseable. You no longer see a blank screen and can click on the folder to view the coverage report – without having to manually copy+paste the folder name into the url.

ea0fcbda-6871-11e3-91d5-ea4a3e522306

I’ve put the code into a GIST: https://gist.github.com/sdeering/8035033

Then when you click on the folder it loads the coverage report.

Image

Which you can then drill down into see what code has tests written for and what doesn’t.

Image

Sam is a web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and love to share what he learns.

Leave a Reply

Your email address will not be published. Required fields are marked *