diff --git a/doc/api/assert.md b/doc/api/assert.md index 16aa242ec03029..afc92b4bbbc927 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -220,8 +220,9 @@ are also recursively evaluated by the following rules. * [`Symbol`][] properties are not compared. * [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. -The following example does not throw an `AssertionError` because the primitives -are considered equal by the [Abstract Equality Comparison][] ( `==` ). +The following example does not throw an [`AssertionError`][] because the +primitives are considered equal by the [Abstract Equality Comparison][] +( `==` ). ```js // WARNING: This does not throw an AssertionError! @@ -266,11 +267,11 @@ assert.deepEqual(obj1, obj4); // AssertionError: { a: { b: 1 } } deepEqual {} ``` -If the values are not equal, an `AssertionError` is thrown with a `message` +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`. +[`AssertionError`][]. ## assert.deepStrictEqual(actual, expected[, message]) @@ -533,8 +534,8 @@ assert.doesNotThrow( ); ``` -If an `AssertionError` is thrown and a value is provided for the `message` -parameter, the value of `message` will be appended to the `AssertionError` +If an [`AssertionError`][] is thrown and a value is provided for the `message` +parameter, the value of `message` will be appended to the [`AssertionError`][] message: @@ -582,7 +583,7 @@ assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } ``` -If the values are not equal, an `AssertionError` is thrown with a `message` +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 @@ -594,9 +595,9 @@ added: v0.1.21 --> * `message` {string|Error} **Default:** `'Failed'` -Throws an `AssertionError` with the provided error message or a default error -message. If the `message` parameter is an instance of an [`Error`][] then it -will be thrown instead of the `AssertionError`. +Throws an [`AssertionError`][] with the provided error message or a default +error message. If the `message` parameter is an instance of an [`Error`][] then +it will be thrown instead of the [`AssertionError`][]. ```js const assert = require('assert').strict; @@ -683,7 +684,7 @@ changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/18247 description: Instead of throwing the original error it is now wrapped into - an `AssertionError` that contains the full stack trace. + an [`AssertionError`][] that contains the full stack trace. - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/18247 description: Value may now only be `undefined` or `null`. Before all falsy @@ -789,11 +790,11 @@ assert.notDeepEqual(obj1, obj4); // OK ``` -If the values are deeply 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`. +If the values are deeply 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.notDeepStrictEqual(actual, expected[, message])