Parse jacoco report files, and return a JSON representation in a lcov-parse compatible manner.
$ npm i @cvrg-report/jacoco-json --save
var jacoco = require("@cvrg-report/jacoco-json");
// Parse by file path
jacoco.parseFile("filepath.xml")
.then(function (result) {
console.log(JSON.stringify(result));
}).catch(function (err) {
console.error(err);
});
// Parse by file contents
jacoco.parseContent("<?xml version=\"1.0\" ?><report>...</report>")
.then(function (result) {
console.log(JSON.stringify(result));
}).catch(function (err) {
console.error(err);
});
CLI
chmod +x ./src/bin.js
./src/bin.js /Users/sghita/Downloads/jacocoTestReport.xml
This repo was initially forked from vokal/jacoco-parse. Thanks a lot!