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.
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.
I’ve put the code into a GIST: https://gist.github.com/sdeering/8035033
1 2 3 4 5 6 7 8 9 10 11 12 |
coverage: { options: { // required for output on index.html base filepath base: __dirname + 'test/coverage/', // required to override base to make the directory browseable directory: __dirname + 'test/coverage/', port: '5555', keepalive: true } } |
Then when you click on the folder it loads the coverage report.
Which you can then drill down into see what code has tests written for and what doesn’t.