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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expanded Timeout Error Messages #2454
Conversation
@dasilvacontin Any thoughts? I'm curious what you think of this approach. |
I personally prefer when code stuff is surrounded with backticks. So Promise -> Also, given that this is a common error, we should consider adding an url/link to a Wiki page with some examples, and behaviour explanations, specially once we solve doubts at #1320. |
Also, we will not remove: if (result && utils.isPromise(result)) {
return done(new Error('Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'));
} until we make a decision about the behaviour. Thanks for kickstarting the improved error messages. :) |
@dasilvacontin Sounds good. I'll split the PR (timeout messages vs yielding) and make the changes to the error messages. 馃憤 |
@@ -365,11 +379,11 @@ Runnable.prototype.run = function(fn) { | |||
} | |||
return done(new Error('done() invoked with non-Error: ' + err)); | |||
} | |||
if (result && utils.isPromise(result)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
@@ -227,7 +228,20 @@ 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.')); | |||
|
|||
var errorMsg = 'timeout of ' + ms + 'ms exceeded.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once L368-L370 is reverted, will the logic here need to change?
This appears to address #2521, in theory |
The timeout error now provides feedback about how the test timed out, and how Mocha expected the test to yield. The purpose of this change is to aid developers when debugging timeouts, especially the case where both
done()
is requested and apromise
is returned. It also removes "Resolution method is overspecified" error as it had a similar effect, but could introduce problems when used with CoffeeScript orasync function
s from ES7.The error messages are perhaps rough copy. I think the maintainers a best suited to re-word the errors if they see it as necessary. Add you suggestions below and I'll update them. That goes for the code too of course.
The following tests:
Results in the following test output:
cc: @dasilvacontin, @boneskull
馃嵒