Skip to content

Commit 4f87059

Browse files
committed
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).
1 parent da68f29 commit 4f87059

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/watcher.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,15 @@ class Watcher {
107107
}
108108
}
109109

110-
this.busy = api.run(specificFiles || files, {runOnlyExclusive}).then(runStatus => {
111-
runStatus.previousFailCount = this.sumPreviousFailures(currentVector);
112-
logger.finish(runStatus);
113-
114-
const badCounts = runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount;
115-
this.clearLogOnNextRun = this.clearLogOnNextRun && badCounts === 0;
116-
}, rethrowAsync);
110+
this.busy = api.run(specificFiles || files, {runOnlyExclusive})
111+
.then(runStatus => {
112+
runStatus.previousFailCount = this.sumPreviousFailures(currentVector);
113+
logger.finish(runStatus);
114+
115+
const badCounts = runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount;
116+
this.clearLogOnNextRun = this.clearLogOnNextRun && badCounts === 0;
117+
})
118+
.catch(rethrowAsync);
117119
};
118120

119121
this.testDependencies = [];

0 commit comments

Comments
 (0)