mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
assert: throw without args in ok
`assert.ok()` should always receive a value. Otherwise there might be a bug or it was intended to use `assert.fail()`. PR-URL: https://github.com/nodejs/node/pull/17581 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl>
This commit is contained in:
parent
f76ef50432
commit
d07c6f9739
3 changed files with 22 additions and 0 deletions
|
@ -133,6 +133,9 @@ function getBuffer(fd, assertLine) {
|
|||
function innerOk(args, fn) {
|
||||
var [value, message] = args;
|
||||
|
||||
if (args.length === 0)
|
||||
throw new errors.TypeError('ERR_MISSING_ARGS', 'value');
|
||||
|
||||
if (!value) {
|
||||
if (message == null) {
|
||||
// Use the call as error message if possible.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue