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:
Ruben Bridgewater 2018-01-15 23:37:09 +01:00
parent f76ef50432
commit d07c6f9739
No known key found for this signature in database
GPG key ID: F07496B3EB3C1762
3 changed files with 22 additions and 0 deletions

View file

@ -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.