Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Added a reminder about the done() callback to test timeout error messages

Ian Zamojce827a793b812
diff --git a/lib/runnable.js b/lib/runnable.js
index cad9dc78..9b216abb 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -156,7 +156,7 @@ Runnable.prototype.resetTimeout = function(){
this.clearTimeout();
this.timer = setTimeout(function(){
if (!self._enableTimeouts) return;
- self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
+ self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
self.timedOut = true;
}, ms);
};
@@ -203,7 +203,7 @@ Runnable.prototype.run = function(fn){
self.clearTimeout();
self.duration = new Date - start;
finished = true;
- if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded');
+ if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.');
fn(err);
}
diff --git a/mocha.js b/mocha.js
index 6352ac70..128dbd84 100644
--- a/mocha.js
+++ b/mocha.js
@@ -4401,7 +4401,7 @@ Runnable.prototype.resetTimeout = function(){
this.clearTimeout();
this.timer = setTimeout(function(){
if (!self._enableTimeouts) return;
- self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
+ self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
self.timedOut = true;
}, ms);
};
@@ -4448,7 +4448,7 @@ Runnable.prototype.run = function(fn){
self.clearTimeout();
self.duration = new Date - start;
finished = true;
- if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded');
+ if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.');
fn(err);
}