From d63a712f209fc3e0ed8296818c54cc0441d1c01a Mon Sep 17 00:00:00 2001 From: Amelia Clarke Date: Fri, 24 Feb 2017 23:17:53 -0800 Subject: [PATCH] doc: argument types for assert methods Refs: https://github.com/nodejs/node/issues/9399 PR-URL: https://github.com/nodejs/node/pull/11548 Reviewed-By: Timothy Gu Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- doc/api/assert.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/api/assert.md b/doc/api/assert.md index 3db5f676886ca8..7bcf64eccb13f5 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -16,6 +16,8 @@ the module. +* `value` {any} +* `message` {any} An alias of [`assert.ok()`][] . @@ -38,6 +40,9 @@ assert(false, 'it\'s false'); +* `actual` {any} +* `expected` {any} +* `message` {any} Tests for deep equality between the `actual` and `expected` parameters. Primitive values are compared with the equal comparison operator ( `==` ). @@ -99,6 +104,9 @@ parameter is undefined, a default error message is assigned. +* `actual` {any} +* `expected` {any} +* `message` {any} Generally identical to `assert.deepEqual()` with two exceptions. First, primitive values are compared using the strict equality operator ( `===` ). @@ -123,6 +131,9 @@ parameter is undefined, a default error message is assigned. +* `block` {Function} +* `error` {RegExp|Function} +* `message` {any} Asserts that the function `block` does not throw an error. See [`assert.throws()`][] for more details. @@ -178,6 +189,9 @@ assert.doesNotThrow( +* `actual` {any} +* `expected` {any} +* `message` {any} Tests shallow, coercive equality between the `actual` and `expected` parameters using the equal comparison operator ( `==` ). @@ -204,6 +218,10 @@ parameter is undefined, a default error message is assigned. +* `actual` {any} +* `expected` {any} +* `message` {any} +* `operator` {String} Throws an `AssertionError`. If `message` is falsy, the error message is set as the values of `actual` and `expected` separated by the provided `operator`. @@ -223,6 +241,7 @@ assert.fail(1, 2, 'whoops', '>'); +* `value` {any} Throws `value` if `value` is truthy. This is useful when testing the `error` argument in callbacks. @@ -244,6 +263,9 @@ assert.ifError(new Error()); +* `actual` {any} +* `expected` {any} +* `message` {any} Tests for any deep inequality. Opposite of [`assert.deepEqual()`][]. @@ -288,6 +310,9 @@ parameter is undefined, a default error message is assigned. +* `actual` {any} +* `expected` {any} +* `message` {any} Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][]. @@ -309,6 +334,9 @@ the `message` parameter is undefined, a default error message is assigned. +* `actual` {any} +* `expected` {any} +* `message` {any} Tests shallow, coercive inequality with the not equal comparison operator ( `!=` ). @@ -334,6 +362,9 @@ parameter is undefined, a default error message is assigned. +* `actual` {any} +* `expected` {any} +* `message` {any} Tests strict inequality as determined by the strict not equal operator ( `!==` ). @@ -359,6 +390,8 @@ If the values are strictly equal, an `AssertionError` is thrown with a +* `value` {any} +* `message` {any} Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`. @@ -386,6 +419,9 @@ assert.ok(false, 'it\'s false'); +* `actual` {any} +* `expected` {any} +* `message` {any} Tests strict equality as determined by the strict equality operator ( `===` ). @@ -410,6 +446,9 @@ If the values are not strictly equal, an `AssertionError` is thrown with a +* `block` {Function} +* `error` {RegExp|Function} +* `message` {any} Expects the function `block` to throw an error.