jimivdw / grunt-mutation-testing

JavaScript Mutation Testing as grunt plugin. Tests your tests by mutating the code.
MIT License
51 stars 11 forks source link

Karma Code Coverage reports invalid format when there's no coverage #67

Open divido opened 8 years ago

divido commented 8 years ago

KarmaCodeSpecsMatcher expects to see a nesting for the coverage output, which is generally true. However, when there's no coverage, will be blank. As a result, the ".forEach" call invokes an error and the program outputs a warning about invalid format. It still falls back on a full mapping, which works, but I'm trying to improve run speed.

I was able to adjust this so it would return a blank result if the "lines-covered" was zero, and that seems to do what I expect it to. I can make a pull request if desired, https://github.com/divido/grunt-mutation-testing/tree/fix-karma-code-specs

However, I surprised this hasn't come up. Wouldn't everybody always have zero base coverage? It doesn't include any specs -- there's therefore nothing to run. I'm concerned that I'm missing the point, or have something misconfigured. Heck, maybe I broke it myself with #60.

In case it's related, I'm using the karma-dojo plugin, and all of my source uses AMD-style modules.