doc: improve common.mustCall() explanation#10390
Conversation
|
|
||
| Number of times `fn` should be called. | ||
| Returns a function that calls `fn`. If the returned function has not been called | ||
| exactly `expected` number of times when the test is complete, then the test will |
There was a problem hiding this comment.
We may want to specify that:
- It checks during
process.on('exit') - Wrapping
exithandlers causes problems.
|
When using this function the second parameter seems, even after looking at the source code multiple times, not clear enough for me. If you don't provide the number 1 it throws. I think the reason for this second parameter and for what it's used for should also be documented. |
That's exactly what this PR does. (Are you sure you are looking at the documentation change in this PR and not what is currently in master?)
That's incorrect. The second parameter is called If you do not provide a number, it defaults to 1. That is also currently documented. This PR includes documentation that says:
That's the behavior you are seeing. I welcome a suggestion for better wording. Perhaps this?:
|
|
I'm sorry, I checked the code out again after your PR and probably mixed some things up. The wording is solid and makes it clearer now. Thanks for the help! |
PR-URL: nodejs#10390 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10390 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10390 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10390 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10390 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10390 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Julian Duque <julianduquej@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com>

Checklist
Affected core subsystem(s)
test
Description of change