Providing relative paths to Istanbul. now reports actually show up in the reports directory rather than next to my .sol files and css/js references work

pull/116/head
Dan Phifer 7 years ago
parent b967e7b8be
commit 30eedbec7b
  1. 13
      lib/app.js

@ -218,11 +218,12 @@ class App {
return new Promise((resolve, reject) => {
try {
this.coverage.generate(this.events, `${this.workingDir}/contracts`);
const newCoverage = App.makeKeysRelative(this.coverage.coverage, this.workingDir);
const json = JSON.stringify(this.coverage.coverage);
const json = JSON.stringify(newCoverage);
fs.writeFileSync('./coverage.json', json);
collector.add(this.coverage.coverage);
collector.add(newCoverage);
reporter.add('html');
reporter.add('lcov');
reporter.add('text');
@ -240,6 +241,14 @@ class App {
// ------------------------------------------ Utils ----------------------------------------------
static makeKeysRelative(map, root) {
const newCoverage = {};
Object.keys(map).forEach(pathKey => {
newCoverage[path.relative(root, pathKey)] = map[pathKey];
});
return newCoverage;
}
/**
* Allows config to turn logging off (for CI)
* @param {Boolean} isSilent

Loading…
Cancel
Save