diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2017-06-28 19:57:02 -0400 |
---|---|---|
committer | Refael Ackermann <refack@gmail.com> | 2017-07-01 22:23:29 -0400 |
commit | fc463639fa38434a3360a1e3695d7ded029242c3 (patch) | |
tree | d4c103c615d8de9ee47d4b495887f3dceced303e /doc/api/assert.md | |
parent | 7022260b550c5bc46bd247109252c886bab40534 (diff) | |
download | android-node-v8-fc463639fa38434a3360a1e3695d7ded029242c3.tar.gz android-node-v8-fc463639fa38434a3360a1e3695d7ded029242c3.tar.bz2 android-node-v8-fc463639fa38434a3360a1e3695d7ded029242c3.zip |
assert: fix assert.fail with zero arguments
PR-URL: https://github.com/nodejs/node/pull/13974
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/assert.md')
-rw-r--r-- | doc/api/assert.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md index 1a040a927b..502150fd8d 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -256,19 +256,20 @@ If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. -## assert.fail(message) +## assert.fail([message]) ## assert.fail(actual, expected, message, operator) <!-- YAML added: v0.1.21 --> * `actual` {any} * `expected` {any} -* `message` {any} +* `message` {any} (default: 'Failed') * `operator` {string} (default: '!=') Throws an `AssertionError`. If `message` is falsy, the error message is set as the values of `actual` and `expected` separated by the provided `operator`. Otherwise, the error message is the value of `message`. +If no arguments are provided at all, a default message will be used instead. ```js const assert = require('assert'); @@ -284,6 +285,9 @@ assert.fail('boom'); assert.fail('a', 'b'); // AssertionError: 'a' != 'b' + +assert.fail(); +// AssertionError: Failed ``` ## assert.ifError(value) |