-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Document the done()
contract
#3134
Labels
area: documentation
anything involving docs or mochajs.org
good first issue
new contributors should look here!
status: accepting prs
Mocha can use your help with this one!
Comments
boneskull
added
area: documentation
anything involving docs or mochajs.org
pr-please
labels
Dec 9, 2017
boneskull
added
status: accepting prs
Mocha can use your help with this one!
good first issue
new contributors should look here!
and removed
pr-please
labels
Dec 9, 2017
This was referenced Jan 3, 2018
boneskull
pushed a commit
that referenced
this issue
Jan 9, 2018
* docs: Error/undefined params to the 'done' callback
This was referenced Jan 18, 2018
This was referenced Sep 22, 2018
Closed
Closed
This was referenced Sep 23, 2018
This was referenced Oct 2, 2018
This was referenced Oct 28, 2018
This was referenced Nov 12, 2018
This was referenced Dec 1, 2018
This was referenced Dec 8, 2018
This was referenced Dec 23, 2018
sgilroy
pushed a commit
to TwineHealth/mocha
that referenced
this issue
Feb 27, 2019
…s#3134 * docs: Error/undefined params to the 'done' callback
Commenting here even though the issue is closed already: I think the docs are still unclear about the treating of Error instances:
To me this sounds like passing an Error instance to done() will cause the test to pass, but this is obviously not the case. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: documentation
anything involving docs or mochajs.org
good first issue
new contributors should look here!
status: accepting prs
Mocha can use your help with this one!
From @FagnerMartinsBrack on February 22, 2016 6:57
When I call
done()
passing a nonError
instance (let's say an error Object Literal, for instance) I get the following message:If the contract is that you should pass an
Error
instance to theasync
done
handler, then that should be documented. I couldn't find that when looking at the site, only looking at the internals (which, as we all know, should not be relied upon).If you pass a String (
done("it should not do this")
), according to the source, it is supposed to be casted accordingly, but then the result will be something like:That is interpreted as a mistake, but then the docs should reflect what should be done to prevent that mistake.
Below is the relevant piece of code from source (2.4.5):
TL DR;
Document that
done
accepts eitherundefined
oran Error object
to reflect the current undocumented behavior.Copied from original issue: mochajs/old-mochajs-site#24
The text was updated successfully, but these errors were encountered: