Parse cobertura report files, and return a JSON representation in a lcov-parse compatible manner.
npm install @cvrg-report/cobertura-json --save
var cobertura = require( "@cvrg-report/cobertura-json" );
// Parse by file path
cobertura.parseFile("filepath.xml")
.then(function (result) {
console.log(JSON.stringify(result));
}).catch(function (err) {
console.error(err);
});
// Parse by file contents
cobertura.parseContent("<?xml version=\"1.0\" ?><coverage>...</coverage>")
.then(function (result) {
console.log(JSON.stringify(result));
}).catch(function (err) {
console.error(err);
});
This repo was initially forked from vokal/cobertura-parse. Thanks a lot!