test: use common.fail() instead of assert(false)#10899
Conversation
There was a problem hiding this comment.
Nit: any reason for not using c.on('connect', common.fail);?
There was a problem hiding this comment.
common.fail() expects a message for the first argument. If you do c.on('connect', common.fail);, you end up with AssertionError: null undefined null which is not nearly as useful as AssertionError: client should not have connected.
There was a problem hiding this comment.
Yeah, but there are other cases where this is already done, for example https://github.com/nodejs/node/pull/10899/files#diff-74c7cfcd74dc6766c9877fac9daf0721R19.
I'm also not a fan of using common.fail() when the argument is not a string for example when it used as a 'request' listener or similar as you end up with AssertionError: [object Object].
PR-URL: nodejs#10899 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #10899 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#10899 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#10899 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
This will need backport PRs to land on v6 or v4 |
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test