Question

Summary

I've recently switched from using Google's JsTestDriver to Testem but miss LCOV HTML Code Coverage Reports, is there a way to convert JSCover output into LCOV format, so I can use genhtml to create reports like these.

Detail

I'm working from a JSCoverage example using Testem, Jasmine and PhantomJS which generates the 2 following coverage output formats;

coverage.xml

<report>
  <stats>
    <packages value="1"/>
    <classes value="1"/>
    <methods value="1"/>
    <srcfiles value="1"/>
    <srclines value="3"/>
  </stats>
  <data>
    <all name="all classes">
      <coverage type="class, %" value="100% (1/1)"/>
      <coverage type="method, %" value="100% (1/1)"/>
      <coverage type="block, %" value="100% (1/1)"/>
      <coverage type="line, %" value="100% (3/3)"/>
    </all>
  </data>
</report>

jscoverage.json

{
  "hello.js": {
    "coverage": [null, 1, 1, 1],
    "source": ["(function(exports) {", "    exports.hello = function(){", "        return \"hello world\";", "    }", "})(typeof(module) !== \"undefined\" ? module.exports : this);"]
  }
}

Is there a way to cover the above into the jstestdriver.conf-coverage.dat format output by js-test-driver?

Thanks.

Was it helpful?

Solution

Is there a way to convert JSCover output into LCOV format

Yes, see: http://tntim96.github.com/JSCover/manual/manual.xml#reportConversion

In summary

java -cp JSCover-all.jar jscover.report.Main --format=LCOV REPORT-DIR SRC-DIRECTORY
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top