From 152657059ba93dbabc5ba84dbb07f6398d2de6a1 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Wed, 8 Feb 2017 12:43:57 +0000 Subject: [PATCH] Ensure watcher rethrows logger errors The watcher would break if logger.finish() threw an exception. Instead rethrow this error (which causes the process to exit). --- lib/watcher.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/watcher.js b/lib/watcher.js index 7b5781cf0..420681987 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -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 = [];