Permalink
Browse files

refactor: Do not abuse exit override to collect coverage

  • Loading branch information...
honzajavorek committed Aug 3, 2017
1 parent 54d5c5c commit dde8936b50c02874ed0f44014c76fe8287c53170
Showing with 4 additions and 7 deletions.
  1. +4 −7 bin/dredd
View
@@ -19,13 +19,12 @@ var dreddCli = new DreddCommand({
custom: {
cwd: process.cwd(),
argv: process.argv.slice(2)
},
exit: exit
}
});
function exit(exitStatus) {
if (process.env.COVERAGE_DIR) {
if (process.env.COVERAGE_DIR) {
process.on('exit', function () {
// Before Dredd exits, we need to collect coverage stats and save them to
// a file. We abuse 'mocha-lcov-reporter' to do this.
var LCov = require('mocha-lcov-reporter');
@@ -52,9 +51,7 @@ function exit(exitStatus) {
// Save stats as lcov file
var file = path.join(process.env.COVERAGE_DIR, 'dredd-bin.info');
fs.appendFileSync(file, content);
}
process.exit(exitStatus);
})
}

0 comments on commit dde8936

Please sign in to comment.