doc: add warning to assert.doesNotThrow() #18699
Conversation
Sorry, something went wrong.
mcollina
left a comment
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
|
Sorry, something went wrong.
|
@ChALkeR I am also pretty sure people use it. The question is though if we want to encourage new people to use a pretty useless API that should be replaced with comments. And because it is used right now, I think a doc only deprecation is best in this case. |
Sorry, something went wrong.
|
@BridgeAR Note that chai implements this differently: http://chaijs.com/api/assert/#method_doesnotthrow
|
Sorry, something went wrong.
|
@ChALkeR yes, the chai implementation has a use case. Even though I am not not sold on testing explicitly against a type of error / message and accept all others. |
Sorry, something went wrong.
cjihrig
left a comment
There was a problem hiding this comment.
I'm -1 to deprecating. Eliminating this from our tests is fine. If people want to use this API for whatever reason, that's their choice.
Sorry, something went wrong.
|
Even without deprecating, we could add a note to |
Sorry, something went wrong.
Sorry, something went wrong.
That holds true even after this documentation only deprecation. There will not be any warning what so ever. But people who try to find out how the assert module works will clearly see that this is actually not that useful. Only adding a regular comment does not solve the same as well because it is not that obvious. I tried to find a single use case but I could not find any. Not with any argument combination. That is why I suggest to doc-only deprecate the API. The |
Sorry, something went wrong.
Right, but a docs deprecation sort of means we're planning to runtime deprecate / remove it one day. |
Sorry, something went wrong.
I am not aware that this is written down anywhere. I do not see that as a necessary subsequent step. I personally would not want to remove this API (probably ever) because it is used too often. A runtime deprecation is probably also not in place for multiple more years out of my perspective. That might be evaluated again at some point of time but even then: to change the deprecation from documentation-only to something else someone has to open a PR for it and it would probably be denied. Therefore I would still like to land this as is. |
Sorry, something went wrong.
jasnell
left a comment
There was a problem hiding this comment.
I'm good with this as a docs-only deprecation does not require that we have to upgrade to to a runtime deprecation later. Although, I'd also be ok with just a docs comment also.
Sorry, something went wrong.
|
I'm still -1 on an official docs deprecation, but am fine with something like @ChALkeR suggested. |
Sorry, something went wrong.
|
@cjihrig as far as I understand your reasons you were mainly against this ever becoming a Runtime deprecation, right? Because I believe there should be other ways to guarantee that than not deprecating this at all. |
Sorry, something went wrong.
|
LGTM with @ChALkeR’s comment Edit, to maybe clarify a bit: API reference documentation is supposed to be more informative than instructive. It’s the same reason we avoid “you” in our documentation. |
Sorry, something went wrong.
Why? I've never really understood this. If you pick a random page from the std library of another language, they all seem to use "you" indiscriminately: Fundamentally we're instructing users of Node in how we think they should use the APIs we provide. Making the tone more formal (e.g. making everything passive) doesn't really change that. |
Sorry, something went wrong.
|
Comments addressed. Lite-CI https://ci.nodejs.org/job/node-test-pull-request-lite/232/ |
Sorry, something went wrong.
Sorry, something went wrong.
Using `assert.doesNotThrow()` has no benefit over adding a comment next to some code that should not throw. Therefore it is from now on discouraged to use it. PR-URL: nodejs#18699 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
I removed the semver-minor label as that does not apply anymore since it is only a comment. |
Sorry, something went wrong.
Using `assert.doesNotThrow()` has no benefit over adding a comment next to some code that should not throw. Therefore it is from now on discouraged to use it. PR-URL: #18699 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Using `assert.doesNotThrow()` has no benefit over adding a comment next to some code that should not throw. Therefore it is from now on discouraged to use it. PR-URL: nodejs#18699 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Using `assert.doesNotThrow()` has no benefit over adding a comment next to some code that should not throw. Therefore it is from now on discouraged to use it. PR-URL: nodejs#18699 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Using `assert.doesNotThrow()` has no benefit over adding a comment next to some code that should not throw. Therefore it is from now on discouraged to use it. Backport-PR-URL: #22380 PR-URL: #18699 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Using
assert.doesNotThrow()has no benefit over adding a commentnext to some code that should not throw. Therefore it is from now
on discouraged to use it.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
doc, assert