Skip to content

Commit 93bba4e

Browse files
aduh95RafaelGSS
authored andcommitted
doc: make MDN links to global classes more consistent in assert.md
PR-URL: #56920 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent ad03c85 commit 93bba4e

File tree

1 file changed

+31
-39
lines changed

1 file changed

+31
-39
lines changed

doc/api/assert.md

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ added: v0.1.21
150150
* `stackStartFn` {Function} If provided, the generated stack trace omits
151151
frames before this function.
152152

153-
A subclass of `Error` that indicates the failure of an assertion.
153+
A subclass of {Error} that indicates the failure of an assertion.
154154

155155
All instances contain the built-in `Error` properties (`message` and `name`)
156156
and:
@@ -621,22 +621,22 @@ are also recursively evaluated by the following rules.
621621
### Comparison details
622622

623623
* Primitive values are compared with the [`==` operator][],
624-
with the exception of `NaN`. It is treated as being identical in case
625-
both sides are `NaN`.
624+
with the exception of {NaN}. It is treated as being identical in case
625+
both sides are {NaN}.
626626
* [Type tags][Object.prototype.toString()] of objects should be the same.
627627
* Only [enumerable "own" properties][] are considered.
628-
* [`Error`][] names, messages, causes, and errors are always compared,
628+
* {Error} names, messages, causes, and errors are always compared,
629629
even if these are not enumerable properties.
630630
* [Object wrappers][] are compared both as objects and unwrapped values.
631631
* `Object` properties are compared unordered.
632-
* [`Map`][] keys and [`Set`][] items are compared unordered.
632+
* {Map} keys and {Set} items are compared unordered.
633633
* Recursion stops when both sides differ or both sides encounter a circular
634634
reference.
635635
* Implementation does not test the [`[[Prototype]]`][prototype-spec] of
636636
objects.
637-
* [`Symbol`][] properties are not compared.
638-
* [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values.
639-
* [`RegExp`][] lastIndex, flags, and source are always compared, even if these
637+
* {Symbol} properties are not compared.
638+
* {WeakMap} and {WeakSet} comparison does not rely on their values.
639+
* {RegExp} lastIndex, flags, and source are always compared, even if these
640640
are not enumerable properties.
641641

642642
The following example does not throw an [`AssertionError`][] because the
@@ -732,7 +732,7 @@ assert.deepEqual(obj1, obj4);
732732
If the values are not equal, an [`AssertionError`][] is thrown with a `message`
733733
property set equal to the value of the `message` parameter. If the `message`
734734
parameter is undefined, a default error message is assigned. If the `message`
735-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
735+
parameter is an instance of {Error} then it will be thrown instead of the
736736
[`AssertionError`][].
737737

738738
## `assert.deepStrictEqual(actual, expected[, message])`
@@ -790,20 +790,20 @@ are recursively evaluated also by the following rules.
790790
* [`[[Prototype]]`][prototype-spec] of objects are compared using
791791
the [`===` operator][].
792792
* Only [enumerable "own" properties][] are considered.
793-
* [`Error`][] names, messages, causes, and errors are always compared,
793+
* {Error} names, messages, causes, and errors are always compared,
794794
even if these are not enumerable properties.
795795
`errors` is also compared.
796-
* Enumerable own [`Symbol`][] properties are compared as well.
796+
* Enumerable own {Symbol} properties are compared as well.
797797
* [Object wrappers][] are compared both as objects and unwrapped values.
798798
* `Object` properties are compared unordered.
799-
* [`Map`][] keys and [`Set`][] items are compared unordered.
799+
* {Map} keys and {Set} items are compared unordered.
800800
* Recursion stops when both sides differ or both sides encounter a circular
801801
reference.
802-
* [`WeakMap`][] and [`WeakSet`][] instances are **not** compared structurally.
802+
* {WeakMap} and {WeakSet} instances are **not** compared structurally.
803803
They are only equal if they reference the same object. Any comparison between
804804
different `WeakMap` or `WeakSet` instances will result in inequality,
805805
even if they contain the same entries.
806-
* [`RegExp`][] lastIndex, flags, and source are always compared, even if these
806+
* {RegExp} lastIndex, flags, and source are always compared, even if these
807807
are not enumerable properties.
808808

809809
```mjs
@@ -1029,7 +1029,7 @@ assert.deepStrictEqual(weakSet1, weakSet1);
10291029
If the values are not equal, an [`AssertionError`][] is thrown with a `message`
10301030
property set equal to the value of the `message` parameter. If the `message`
10311031
parameter is undefined, a default error message is assigned. If the `message`
1032-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1032+
parameter is an instance of {Error} then it will be thrown instead of the
10331033
`AssertionError`.
10341034

10351035
## `assert.doesNotMatch(string, regexp[, message])`
@@ -1080,7 +1080,7 @@ If the values do match, or if the `string` argument is of another type than
10801080
`string`, an [`AssertionError`][] is thrown with a `message` property set equal
10811081
to the value of the `message` parameter. If the `message` parameter is
10821082
undefined, a default error message is assigned. If the `message` parameter is an
1083-
instance of an [`Error`][] then it will be thrown instead of the
1083+
instance of {Error} then it will be thrown instead of the
10841084
[`AssertionError`][].
10851085

10861086
## `assert.doesNotReject(asyncFn[, error][, message])`
@@ -1108,7 +1108,7 @@ benefit in catching a rejection and then rejecting it again. Instead, consider
11081108
adding a comment next to the specific code path that should not reject and keep
11091109
error messages as expressive as possible.
11101110

1111-
If specified, `error` can be a [`Class`][], [`RegExp`][], or a validation
1111+
If specified, `error` can be a [`Class`][], {RegExp} or a validation
11121112
function. See [`assert.throws()`][] for more details.
11131113

11141114
Besides the async nature to await the completion behaves identically to
@@ -1190,10 +1190,10 @@ parameter, then an [`AssertionError`][] is thrown. If the error is of a
11901190
different type, or if the `error` parameter is undefined, the error is
11911191
propagated back to the caller.
11921192

1193-
If specified, `error` can be a [`Class`][], [`RegExp`][], or a validation
1193+
If specified, `error` can be a [`Class`][], {RegExp}, or a validation
11941194
function. See [`assert.throws()`][] for more details.
11951195

1196-
The following, for instance, will throw the [`TypeError`][] because there is no
1196+
The following, for instance, will throw the {TypeError} because there is no
11971197
matching error type in the assertion:
11981198

11991199
```mjs
@@ -1341,7 +1341,7 @@ assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
13411341
If the values are not equal, an [`AssertionError`][] is thrown with a `message`
13421342
property set equal to the value of the `message` parameter. If the `message`
13431343
parameter is undefined, a default error message is assigned. If the `message`
1344-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1344+
parameter is an instance of {Error} then it will be thrown instead of the
13451345
`AssertionError`.
13461346

13471347
## `assert.fail([message])`
@@ -1353,7 +1353,7 @@ added: v0.1.21
13531353
* `message` {string|Error} **Default:** `'Failed'`
13541354

13551355
Throws an [`AssertionError`][] with the provided error message or a default
1356-
error message. If the `message` parameter is an instance of an [`Error`][] then
1356+
error message. If the `message` parameter is an instance of {Error} then
13571357
it will be thrown instead of the [`AssertionError`][].
13581358

13591359
```mjs
@@ -1605,7 +1605,7 @@ If the values do not match, or if the `string` argument is of another type than
16051605
`string`, an [`AssertionError`][] is thrown with a `message` property set equal
16061606
to the value of the `message` parameter. If the `message` parameter is
16071607
undefined, a default error message is assigned. If the `message` parameter is an
1608-
instance of an [`Error`][] then it will be thrown instead of the
1608+
instance of {Error} then it will be thrown instead of the
16091609
[`AssertionError`][].
16101610

16111611
## `assert.notDeepEqual(actual, expected[, message])`
@@ -1729,7 +1729,7 @@ assert.notDeepEqual(obj1, obj4);
17291729
If the values are deeply equal, an [`AssertionError`][] is thrown with a
17301730
`message` property set equal to the value of the `message` parameter. If the
17311731
`message` parameter is undefined, a default error message is assigned. If the
1732-
`message` parameter is an instance of an [`Error`][] then it will be thrown
1732+
`message` parameter is an instance of {Error} then it will be thrown
17331733
instead of the `AssertionError`.
17341734

17351735
## `assert.notDeepStrictEqual(actual, expected[, message])`
@@ -1789,7 +1789,7 @@ assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
17891789
If the values are deeply and strictly equal, an [`AssertionError`][] is thrown
17901790
with a `message` property set equal to the value of the `message` parameter. If
17911791
the `message` parameter is undefined, a default error message is assigned. If
1792-
the `message` parameter is an instance of an [`Error`][] then it will be thrown
1792+
the `message` parameter is an instance of {Error} then it will be thrown
17931793
instead of the [`AssertionError`][].
17941794

17951795
## `assert.notEqual(actual, expected[, message])`
@@ -1853,7 +1853,7 @@ assert.notEqual(1, '1');
18531853
If the values are equal, an [`AssertionError`][] is thrown with a `message`
18541854
property set equal to the value of the `message` parameter. If the `message`
18551855
parameter is undefined, a default error message is assigned. If the `message`
1856-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1856+
parameter is an instance of {Error} then it will be thrown instead of the
18571857
`AssertionError`.
18581858

18591859
## `assert.notStrictEqual(actual, expected[, message])`
@@ -1906,7 +1906,7 @@ assert.notStrictEqual(1, '1');
19061906
If the values are strictly equal, an [`AssertionError`][] is thrown with a
19071907
`message` property set equal to the value of the `message` parameter. If the
19081908
`message` parameter is undefined, a default error message is assigned. If the
1909-
`message` parameter is an instance of an [`Error`][] then it will be thrown
1909+
`message` parameter is an instance of {Error} then it will be thrown
19101910
instead of the `AssertionError`.
19111911

19121912
## `assert.ok(value[, message])`
@@ -1929,7 +1929,7 @@ Tests if `value` is truthy. It is equivalent to
19291929
If `value` is not truthy, an [`AssertionError`][] is thrown with a `message`
19301930
property set equal to the value of the `message` parameter. If the `message`
19311931
parameter is `undefined`, a default error message is assigned. If the `message`
1932-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1932+
parameter is an instance of {Error} then it will be thrown instead of the
19331933
`AssertionError`.
19341934
If no arguments are passed in at all `message` will be set to the string:
19351935
``'No value argument passed to `assert.ok()`'``.
@@ -2050,7 +2050,7 @@ handler is skipped.
20502050
Besides the async nature to await the completion behaves identically to
20512051
[`assert.throws()`][].
20522052

2053-
If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function,
2053+
If specified, `error` can be a [`Class`][], {RegExp}, a validation function,
20542054
an object where each property will be tested for, or an instance of error where
20552055
each property will be tested for including the non-enumerable `message` and
20562056
`name` properties.
@@ -2224,7 +2224,7 @@ assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
22242224
If the values are not strictly equal, an [`AssertionError`][] is thrown with a
22252225
`message` property set equal to the value of the `message` parameter. If the
22262226
`message` parameter is undefined, a default error message is assigned. If the
2227-
`message` parameter is an instance of an [`Error`][] then it will be thrown
2227+
`message` parameter is an instance of {Error} then it will be thrown
22282228
instead of the [`AssertionError`][].
22292229

22302230
## `assert.throws(fn[, error][, message])`
@@ -2250,7 +2250,7 @@ changes:
22502250

22512251
Expects the function `fn` to throw an error.
22522252

2253-
If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function,
2253+
If specified, `error` can be a [`Class`][], {RegExp}, a validation function,
22542254
a validation object where each property will be tested for strict deep equality,
22552255
or an instance of error where each property will be tested for strict deep
22562256
equality including the non-enumerable `message` and `name` properties. When
@@ -2425,7 +2425,7 @@ assert.throws(
24252425
);
24262426
```
24272427

2428-
Validate error message using [`RegExp`][]:
2428+
Validate error message using {RegExp}:
24292429

24302430
Using a regular expression runs `.toString` on the error object, and will
24312431
therefore also include the error name.
@@ -2681,15 +2681,7 @@ assert.partialDeepStrictEqual({ a: { b: 2 } }, { a: { b: '2' } });
26812681
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
26822682
[`ERR_INVALID_RETURN_VALUE`]: errors.md#err_invalid_return_value
26832683
[`Error.captureStackTrace`]: errors.md#errorcapturestacktracetargetobject-constructoropt
2684-
[`Error`]: errors.md#class-error
2685-
[`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
26862684
[`Object.is()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2687-
[`RegExp`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
2688-
[`Set`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
2689-
[`Symbol`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
2690-
[`TypeError`]: errors.md#class-typeerror
2691-
[`WeakMap`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
2692-
[`WeakSet`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet
26932685
[`assert.deepEqual()`]: #assertdeepequalactual-expected-message
26942686
[`assert.deepStrictEqual()`]: #assertdeepstrictequalactual-expected-message
26952687
[`assert.doesNotThrow()`]: #assertdoesnotthrowfn-error-message

0 commit comments

Comments
 (0)