Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Added: allow this.timeout(0) to disable as well

Tj Holowaychuk1bd792164c11
diff --git a/lib/runnable.js b/lib/runnable.js
index 972c1d78..78b4fb67 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -81,8 +81,9 @@ Runnable.prototype.clearTimeout = function(){
Runnable.prototype.resetTimeout = function(){
var self = this
, ms = this.timeout();
+
this.clearTimeout();
- if (false !== ms) {
+ if (ms) {
this.timer = setTimeout(function(){
self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
}, ms);
@@ -105,7 +106,7 @@ Runnable.prototype.run = function(fn){
// timeout
if (this.async) {
- if (false !== ms) {
+ if (ms) {
this.timer = setTimeout(function(){
done(new Error('timeout of ' + ms + 'ms exceeded'));
}, ms);