Skip to content

Commit

Permalink
Merge pull request #8 from 5monkeys/filter-undefined-classes
Browse files Browse the repository at this point in the history
Filter undefined classes
  • Loading branch information
hannseman authored Feb 22, 2020
2 parents 26b2f42 + 42fe488 commit 882bd91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cobertura.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
const fs = require("fs");
const fs = require("fs").promises;
const xml2js = require("xml2js");
const util = require("util");
const parseString = util.promisify(xml2js.parseString);

async function processCoverage(path, options) {
options = options || { skipCovered: false };
const xml = fs.readFileSync(path, "utf-8");
const xml = await fs.readFile(path, "utf-8");
const { coverage } = await parseString(xml, {
explicitArray: false,
mergeAttrs: true
});
const { packages } = coverage;
const classes = processPackages(packages);
const files = classes
.filter(Boolean)
.map(klass => {
return {
...calculateRates(klass),
Expand Down

0 comments on commit 882bd91

Please sign in to comment.