Skip to content

Commit 6bc2707

Browse files
aduh95targos
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 00da003 commit 6bc2707

File tree

1 file changed

+31
-39
lines changed

1 file changed

+31
-39
lines changed

doc/api/assert.md

+31-39
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:
@@ -623,23 +623,23 @@ are also recursively evaluated by the following rules.
623623
### Comparison details
624624

625625
* Primitive values are compared with the [`==` operator][],
626-
with the exception of `NaN`. It is treated as being identical in case
627-
both sides are `NaN`.
626+
with the exception of {NaN}. It is treated as being identical in case
627+
both sides are {NaN}.
628628
* [Type tags][Object.prototype.toString()] of objects should be the same.
629629
* Only [enumerable "own" properties][] are considered.
630-
* [`Error`][] names, messages, causes, and errors are always compared,
630+
* {Error} names, messages, causes, and errors are always compared,
631631
even if these are not enumerable properties.
632632
* [Object wrappers][] are compared both as objects and unwrapped values.
633633
* `Object` properties are compared unordered.
634-
* [`Map`][] keys and [`Set`][] items are compared unordered.
634+
* {Map} keys and {Set} items are compared unordered.
635635
* Recursion stops when both sides differ or both sides encounter a circular
636636
reference.
637637
* Implementation does not test the [`[[Prototype]]`][prototype-spec] of
638638
objects.
639-
* [`Symbol`][] properties are not compared.
640-
* [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values
639+
* {Symbol} properties are not compared.
640+
* {WeakMap} and {WeakSet} comparison does not rely on their values
641641
but only on their instances.
642-
* [`RegExp`][] lastIndex, flags, and source are always compared, even if these
642+
* {RegExp} lastIndex, flags, and source are always compared, even if these
643643
are not enumerable properties.
644644

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

741741
## `assert.deepStrictEqual(actual, expected[, message])`
@@ -795,20 +795,20 @@ are recursively evaluated also by the following rules.
795795
* [`[[Prototype]]`][prototype-spec] of objects are compared using
796796
the [`===` operator][].
797797
* Only [enumerable "own" properties][] are considered.
798-
* [`Error`][] names, messages, causes, and errors are always compared,
798+
* {Error} names, messages, causes, and errors are always compared,
799799
even if these are not enumerable properties.
800800
`errors` is also compared.
801-
* Enumerable own [`Symbol`][] properties are compared as well.
801+
* Enumerable own {Symbol} properties are compared as well.
802802
* [Object wrappers][] are compared both as objects and unwrapped values.
803803
* `Object` properties are compared unordered.
804-
* [`Map`][] keys and [`Set`][] items are compared unordered.
804+
* {Map} keys and {Set} items are compared unordered.
805805
* Recursion stops when both sides differ or both sides encounter a circular
806806
reference.
807-
* [`WeakMap`][] and [`WeakSet`][] instances are **not** compared structurally.
807+
* {WeakMap} and {WeakSet} instances are **not** compared structurally.
808808
They are only equal if they reference the same object. Any comparison between
809809
different `WeakMap` or `WeakSet` instances will result in inequality,
810810
even if they contain the same entries.
811-
* [`RegExp`][] lastIndex, flags, and source are always compared, even if these
811+
* {RegExp} lastIndex, flags, and source are always compared, even if these
812812
are not enumerable properties.
813813

814814
```mjs
@@ -1034,7 +1034,7 @@ assert.deepStrictEqual(weakSet1, weakSet1);
10341034
If the values are not equal, an [`AssertionError`][] is thrown with a `message`
10351035
property set equal to the value of the `message` parameter. If the `message`
10361036
parameter is undefined, a default error message is assigned. If the `message`
1037-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1037+
parameter is an instance of {Error} then it will be thrown instead of the
10381038
`AssertionError`.
10391039

10401040
## `assert.doesNotMatch(string, regexp[, message])`
@@ -1085,7 +1085,7 @@ If the values do match, or if the `string` argument is of another type than
10851085
`string`, an [`AssertionError`][] is thrown with a `message` property set equal
10861086
to the value of the `message` parameter. If the `message` parameter is
10871087
undefined, a default error message is assigned. If the `message` parameter is an
1088-
instance of an [`Error`][] then it will be thrown instead of the
1088+
instance of {Error} then it will be thrown instead of the
10891089
[`AssertionError`][].
10901090

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

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

11191119
Besides the async nature to await the completion behaves identically to
@@ -1195,10 +1195,10 @@ parameter, then an [`AssertionError`][] is thrown. If the error is of a
11951195
different type, or if the `error` parameter is undefined, the error is
11961196
propagated back to the caller.
11971197

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

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

12041204
```mjs
@@ -1346,7 +1346,7 @@ assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
13461346
If the values are not equal, an [`AssertionError`][] is thrown with a `message`
13471347
property set equal to the value of the `message` parameter. If the `message`
13481348
parameter is undefined, a default error message is assigned. If the `message`
1349-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1349+
parameter is an instance of {Error} then it will be thrown instead of the
13501350
`AssertionError`.
13511351

13521352
## `assert.fail([message])`
@@ -1358,7 +1358,7 @@ added: v0.1.21
13581358
* `message` {string|Error} **Default:** `'Failed'`
13591359

13601360
Throws an [`AssertionError`][] with the provided error message or a default
1361-
error message. If the `message` parameter is an instance of an [`Error`][] then
1361+
error message. If the `message` parameter is an instance of {Error} then
13621362
it will be thrown instead of the [`AssertionError`][].
13631363

13641364
```mjs
@@ -1610,7 +1610,7 @@ If the values do not match, or if the `string` argument is of another type than
16101610
`string`, an [`AssertionError`][] is thrown with a `message` property set equal
16111611
to the value of the `message` parameter. If the `message` parameter is
16121612
undefined, a default error message is assigned. If the `message` parameter is an
1613-
instance of an [`Error`][] then it will be thrown instead of the
1613+
instance of {Error} then it will be thrown instead of the
16141614
[`AssertionError`][].
16151615

16161616
## `assert.notDeepEqual(actual, expected[, message])`
@@ -1734,7 +1734,7 @@ assert.notDeepEqual(obj1, obj4);
17341734
If the values are deeply equal, an [`AssertionError`][] is thrown with a
17351735
`message` property set equal to the value of the `message` parameter. If the
17361736
`message` parameter is undefined, a default error message is assigned. If the
1737-
`message` parameter is an instance of an [`Error`][] then it will be thrown
1737+
`message` parameter is an instance of {Error} then it will be thrown
17381738
instead of the `AssertionError`.
17391739

17401740
## `assert.notDeepStrictEqual(actual, expected[, message])`
@@ -1794,7 +1794,7 @@ assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
17941794
If the values are deeply and strictly equal, an [`AssertionError`][] is thrown
17951795
with a `message` property set equal to the value of the `message` parameter. If
17961796
the `message` parameter is undefined, a default error message is assigned. If
1797-
the `message` parameter is an instance of an [`Error`][] then it will be thrown
1797+
the `message` parameter is an instance of {Error} then it will be thrown
17981798
instead of the [`AssertionError`][].
17991799

18001800
## `assert.notEqual(actual, expected[, message])`
@@ -1858,7 +1858,7 @@ assert.notEqual(1, '1');
18581858
If the values are equal, an [`AssertionError`][] is thrown with a `message`
18591859
property set equal to the value of the `message` parameter. If the `message`
18601860
parameter is undefined, a default error message is assigned. If the `message`
1861-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1861+
parameter is an instance of {Error} then it will be thrown instead of the
18621862
`AssertionError`.
18631863

18641864
## `assert.notStrictEqual(actual, expected[, message])`
@@ -1911,7 +1911,7 @@ assert.notStrictEqual(1, '1');
19111911
If the values are strictly equal, an [`AssertionError`][] is thrown with a
19121912
`message` property set equal to the value of the `message` parameter. If the
19131913
`message` parameter is undefined, a default error message is assigned. If the
1914-
`message` parameter is an instance of an [`Error`][] then it will be thrown
1914+
`message` parameter is an instance of {Error} then it will be thrown
19151915
instead of the `AssertionError`.
19161916

19171917
## `assert.ok(value[, message])`
@@ -1934,7 +1934,7 @@ Tests if `value` is truthy. It is equivalent to
19341934
If `value` is not truthy, an [`AssertionError`][] is thrown with a `message`
19351935
property set equal to the value of the `message` parameter. If the `message`
19361936
parameter is `undefined`, a default error message is assigned. If the `message`
1937-
parameter is an instance of an [`Error`][] then it will be thrown instead of the
1937+
parameter is an instance of {Error} then it will be thrown instead of the
19381938
`AssertionError`.
19391939
If no arguments are passed in at all `message` will be set to the string:
19401940
``'No value argument passed to `assert.ok()`'``.
@@ -2055,7 +2055,7 @@ handler is skipped.
20552055
Besides the async nature to await the completion behaves identically to
20562056
[`assert.throws()`][].
20572057

2058-
If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function,
2058+
If specified, `error` can be a [`Class`][], {RegExp}, a validation function,
20592059
an object where each property will be tested for, or an instance of error where
20602060
each property will be tested for including the non-enumerable `message` and
20612061
`name` properties.
@@ -2229,7 +2229,7 @@ assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
22292229
If the values are not strictly equal, an [`AssertionError`][] is thrown with a
22302230
`message` property set equal to the value of the `message` parameter. If the
22312231
`message` parameter is undefined, a default error message is assigned. If the
2232-
`message` parameter is an instance of an [`Error`][] then it will be thrown
2232+
`message` parameter is an instance of {Error} then it will be thrown
22332233
instead of the [`AssertionError`][].
22342234

22352235
## `assert.throws(fn[, error][, message])`
@@ -2255,7 +2255,7 @@ changes:
22552255

22562256
Expects the function `fn` to throw an error.
22572257

2258-
If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function,
2258+
If specified, `error` can be a [`Class`][], {RegExp}, a validation function,
22592259
a validation object where each property will be tested for strict deep equality,
22602260
or an instance of error where each property will be tested for strict deep
22612261
equality including the non-enumerable `message` and `name` properties. When
@@ -2430,7 +2430,7 @@ assert.throws(
24302430
);
24312431
```
24322432

2433-
Validate error message using [`RegExp`][]:
2433+
Validate error message using {RegExp}:
24342434

24352435
Using a regular expression runs `.toString` on the error object, and will
24362436
therefore also include the error name.
@@ -2686,15 +2686,7 @@ assert.partialDeepStrictEqual({ a: { b: 2 } }, { a: { b: '2' } });
26862686
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
26872687
[`ERR_INVALID_RETURN_VALUE`]: errors.md#err_invalid_return_value
26882688
[`Error.captureStackTrace`]: errors.md#errorcapturestacktracetargetobject-constructoropt
2689-
[`Error`]: errors.md#class-error
2690-
[`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
26912689
[`Object.is()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2692-
[`RegExp`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
2693-
[`Set`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
2694-
[`Symbol`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
2695-
[`TypeError`]: errors.md#class-typeerror
2696-
[`WeakMap`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
2697-
[`WeakSet`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet
26982690
[`assert.deepEqual()`]: #assertdeepequalactual-expected-message
26992691
[`assert.deepStrictEqual()`]: #assertdeepstrictequalactual-expected-message
27002692
[`assert.doesNotThrow()`]: #assertdoesnotthrowfn-error-message

0 commit comments

Comments
 (0)