☕️ Classic, reliable, trusted test framework for Node.js and the browser
Fixed: recover from uncaught exceptions for tests. Closes #94
TJ Holowaychukf83c4c7f7f04
diff --git a/lib/runner.js b/lib/runner.jsindex e1d5c318..fc44d1ea 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -313,14 +313,15 @@ Runner.prototype.runTests = function(suite, fn){return self.hookUp('afterEach', next);}- self.emit('pass', test);test.passed = true;+ self.emit('pass', test);self.emit('test end', test);self.hookUp('afterEach', next);});});}+ this.next = next;next();};@@ -394,8 +395,15 @@ Runner.prototype.run = function(fn){debug('uncaught exception');runnable.clearTimeout();self.fail(runnable, err);- if ('test' == runnable.type) self.emit('test end', runnable);- self.emit('end');++ // recover from test+ if ('test' == runnable.type) {+ self.emit('test end', runnable);+ self.hookUp('afterEach', self.next);+ // bail on hooks+ } else {+ self.emit('end');+ }}process.on('uncaughtException', uncaught);