Skip to content

Commit

Permalink
add a more clear timeout message. Closes #2294
Browse files Browse the repository at this point in the history
  • Loading branch information
jeversmann committed Oct 28, 2016
1 parent 0361c85 commit b7cbea2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/runnable.js
Expand Up @@ -229,7 +229,8 @@ Runnable.prototype.resetTimeout = function () {
if (!self._enableTimeouts) {
return;
}
self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
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.timedOut = true;
}, ms);
};
Expand Down Expand Up @@ -288,7 +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 of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.');
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.');
}
fn(err);
}
Expand Down
6 changes: 4 additions & 2 deletions mocha.js
Expand Up @@ -4331,7 +4331,8 @@ Runnable.prototype.resetTimeout = function () {
if (!self._enableTimeouts) {
return;
}
self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
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.timedOut = true;
}, ms);
};
Expand Down Expand Up @@ -4390,7 +4391,8 @@ Runnable.prototype.run = function (fn) {
self.duration = new Date() - start;
finished = true;
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.');
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.');
}
fn(err);
}
Expand Down

0 comments on commit b7cbea2

Please sign in to comment.