☕️ Classic, reliable, trusted test framework for Node.js and the browser
Improve error reporting when a test finishes after it has timed out.
Phil Sung589cf09827f6
diff --git a/lib/runnable.js b/lib/runnable.jsindex 49c35a70..60891291 100644--- a/lib/runnable.js+++ b/lib/runnable.js@@ -26,6 +26,7 @@ function Runnable(title, fn) {this.async = fn && fn.length;this.sync = ! this.async;this._timeout = 2000;+ this.timedOut = false;this.context = this;}@@ -87,6 +88,7 @@ Runnable.prototype.resetTimeout = function(){if (ms) {this.timer = setTimeout(function(){self.callback(new Error('timeout of ' + ms + 'ms exceeded'));+ self.timedOut = true;}, ms);}};@@ -111,6 +113,7 @@ Runnable.prototype.run = function(fn){if (ms) {this.timer = setTimeout(function(){done(new Error('timeout of ' + ms + 'ms exceeded'));+ self.timedOut = true;}, ms);}}@@ -124,6 +127,7 @@ Runnable.prototype.run = function(fn){// finishedfunction done(err) {+ if (self.timedOut) return;if (finished) return multiple();self.clearTimeout();self.duration = new Date - start;