Skip to content

Commit

Permalink
Ensure watcher rethrows logger errors
Browse files Browse the repository at this point in the history
The watcher would break if logger.finish() threw an exception. Instead
rethrow this error (which causes the process to exit).
  • Loading branch information
novemberborn committed Feb 14, 2017
1 parent da68f29 commit 4f87059
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/watcher.js
Expand Up @@ -107,13 +107,15 @@ class Watcher {
}
}

this.busy = api.run(specificFiles || files, {runOnlyExclusive}).then(runStatus => {
runStatus.previousFailCount = this.sumPreviousFailures(currentVector);
logger.finish(runStatus);

const badCounts = runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount;
this.clearLogOnNextRun = this.clearLogOnNextRun && badCounts === 0;
}, rethrowAsync);
this.busy = api.run(specificFiles || files, {runOnlyExclusive})
.then(runStatus => {
runStatus.previousFailCount = this.sumPreviousFailures(currentVector);
logger.finish(runStatus);

const badCounts = runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount;
this.clearLogOnNextRun = this.clearLogOnNextRun && badCounts === 0;
})
.catch(rethrowAsync);
};

this.testDependencies = [];
Expand Down

0 comments on commit 4f87059

Please sign in to comment.