diff --git a/doc/api/assert.md b/doc/api/assert.md index fb33994df1586d..a6c00b71ba8fc9 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -261,10 +261,13 @@ parameter is undefined, a default error message is assigned. If the `message` parameter is an instance of an [`Error`][] then it will be thrown instead of the `AssertionError`. -## assert.deepStrictEqual(actual, expected[, message]) +## assert.deepStrictEqual(actual, expected[, options]) * `actual` {any} * `expected` {any} -* `message` {string|Error} +* `options` {Object|string|Error} + * `checkPrototype` {boolean} Whether to check that `actual` and `expected` + have the same prototype. **Default:** `true` + * `error` {Error} Error to throw if `actual` and `expected` are not deep + equal. **Default:** `AssertionError` + * `message` {string} Message to use to replace the generated default message. + Ignored if `error` is specified. Tests for deep equality between the `actual` and `expected` parameters. -"Deep" equality means that the enumerable "own" properties of child objects -are recursively evaluated also by the following rules. + +If `options` is a string, it is the value of the `message` option. + +If `options` is an `Error` object, then it is the value of the `error` option. + +Enumerable "own" properties of child objects are recursively evaluated by the +following rules. ### Comparison details @@ -408,12 +422,6 @@ assert.deepStrictEqual(weakMap1, weakMap3); // } ``` -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. If the `message` -parameter is an instance of an [`Error`][] then it will be thrown instead of the -`AssertionError`. - ## assert.doesNotReject(asyncFn[, error][, message])