Skip to content

Commit

Permalink
allow user to write coverage at any point
Browse files Browse the repository at this point in the history
  • Loading branch information
joeferner committed May 15, 2012
1 parent 57c75a1 commit 190ead4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/covershot.js
Expand Up @@ -51,11 +51,8 @@ exports.replace = function (regex, replacement) {
replacements.push({ regex: regex, replacement: replacement });
};

process.on('SIGTERM', onExit);
process.on('exit', onExit);

var coverageWritten = false;
function onExit() {
var writeCoverage = exports.writeCoverage = function () {
if (coverageWritten) {
return;
}
Expand All @@ -81,4 +78,6 @@ function onExit() {

var json = JSON.stringify(mapper.map(coverage));
fs.writeFileSync(filename, json);
}
};

process.on('exit', writeCoverage);

0 comments on commit 190ead4

Please sign in to comment.