Skip to content

armgit / mocha

Public Imported from GitHub
0

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

tweak timeout messaging; see #2294

Christopher Hiller004389fe6ccb
diff --git a/lib/runnable.js b/lib/runnable.js
index 6825fb18..e7b6aa12 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -229,8 +229,8 @@ Runnable.prototype.resetTimeout = function () {
if (!self._enableTimeouts) {
return;
}
- self.callback(new Error('timeout! Test didn\'t complete within ' + ms +
- '. For async tests, make sure you are calling \'done\' or that the returned Promise eventually resolves.'));
+ self.callback(new Error('Timeout of ' + ms +
+ 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.'));
self.timedOut = true;
}, ms);
};
@@ -289,8 +289,8 @@ Runnable.prototype.run = function (fn) {
self.duration = new Date() - start;
finished = true;
if (!err && self.duration > ms && self._enableTimeouts) {
- err = new Error('timeout! Test didn\'t complete within ' + ms +
- '. For async tests, make sure you are calling \'done\' or that the returned Promise eventually resolves.');
+ err = new Error('Timeout of ' + ms +
+ 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.');
}
fn(err);
}