Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a more clear timeout message. Closes #2294 #2560

Merged
merged 1 commit into from
Oct 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/runnable.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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