☕️ Classic, reliable, trusted test framework for Node.js and the browser
Added Runnable#clearTimeout()
Tj Holowaychuk2c320e11de29
diff --git a/lib/runnable.js b/lib/runnable.jsindex 3180bff2..6c39c1c6 100644--- a/lib/runnable.js+++ b/lib/runnable.js@@ -61,6 +61,16 @@ Runnable.prototype.fullTitle = function(){return this.parent.fullTitle() + ' ' + this.title;};+/**+ * Clear the timeout.+ *+ * @api private+ */++Runnable.prototype.clearTimeout = function(){+ clearTimeout(this.timer);+};+/*** Run the test and invoke `fn(err)`.*@@ -73,12 +83,11 @@ Runnable.prototype.run = function(fn){, ms = this.timeout(), start = new Date, finished- , emitted- , timer;+ , emitted;// timeoutif (this.async) {- timer = setTimeout(function(){+ this.timer = setTimeout(function(){done(new Error('timeout of ' + ms + 'ms exceeded'));}, ms);}@@ -93,7 +102,7 @@ Runnable.prototype.run = function(fn){// finishedfunction done(err) {if (finished) return multiple();- clearTimeout(timer);+ self.clearTimeout();self.duration = new Date - start;finished = true;fn(err);