Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

add check for runnable in Runner#uncaught(). Closes #494

TJ Holowaychukb255074d3104
diff --git a/lib/runner.js b/lib/runner.js
index 9f94a3be..67ca304b 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -413,7 +413,7 @@ Runner.prototype.runSuite = function(suite, fn){
Runner.prototype.uncaught = function(err){
debug('uncaught exception %s', err.message);
var runnable = this.currentRunnable;
- if ('failed' == runnable.state) return;
+ if (!runnable || 'failed' == runnable.state) return;
runnable.clearTimeout();
err.uncaught = true;
this.fail(runnable, err);