@@ -150,7 +150,7 @@ added: v0.1.21
150
150
* ` stackStartFn ` {Function} If provided, the generated stack trace omits
151
151
frames before this function.
152
152
153
- A subclass of ` Error ` that indicates the failure of an assertion.
153
+ A subclass of { Error} that indicates the failure of an assertion.
154
154
155
155
All instances contain the built-in ` Error ` properties (` message ` and ` name ` )
156
156
and:
@@ -621,22 +621,22 @@ are also recursively evaluated by the following rules.
621
621
### Comparison details
622
622
623
623
* 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} .
626
626
* [ Type tags] [ Object.prototype.toString() ] of objects should be the same.
627
627
* 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,
629
629
even if these are not enumerable properties.
630
630
* [ Object wrappers] [ ] are compared both as objects and unwrapped values.
631
631
* ` Object ` properties are compared unordered.
632
- * [ ` Map ` ] [ ] keys and [ ` Set ` ] [ ] items are compared unordered.
632
+ * { Map} keys and { Set} items are compared unordered.
633
633
* Recursion stops when both sides differ or both sides encounter a circular
634
634
reference.
635
635
* Implementation does not test the [ ` [[Prototype]] ` ] [ prototype-spec ] of
636
636
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
640
640
are not enumerable properties.
641
641
642
642
The following example does not throw an [ ` AssertionError ` ] [ ] because the
@@ -732,7 +732,7 @@ assert.deepEqual(obj1, obj4);
732
732
If the values are not equal, an [ ` AssertionError ` ] [ ] is thrown with a ` message `
733
733
property set equal to the value of the ` message ` parameter. If the ` message `
734
734
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
736
736
[ ` AssertionError ` ] [ ] .
737
737
738
738
## ` assert.deepStrictEqual(actual, expected[, message]) `
@@ -790,20 +790,20 @@ are recursively evaluated also by the following rules.
790
790
* [ ` [[Prototype]] ` ] [ prototype-spec ] of objects are compared using
791
791
the [ ` === ` operator] [ ] .
792
792
* 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,
794
794
even if these are not enumerable properties.
795
795
` errors ` is also compared.
796
- * Enumerable own [ ` Symbol ` ] [ ] properties are compared as well.
796
+ * Enumerable own { Symbol} properties are compared as well.
797
797
* [ Object wrappers] [ ] are compared both as objects and unwrapped values.
798
798
* ` Object ` properties are compared unordered.
799
- * [ ` Map ` ] [ ] keys and [ ` Set ` ] [ ] items are compared unordered.
799
+ * { Map} keys and { Set} items are compared unordered.
800
800
* Recursion stops when both sides differ or both sides encounter a circular
801
801
reference.
802
- * [ ` WeakMap ` ] [ ] and [ ` WeakSet ` ] [ ] instances are ** not** compared structurally.
802
+ * { WeakMap} and { WeakSet} instances are ** not** compared structurally.
803
803
They are only equal if they reference the same object. Any comparison between
804
804
different ` WeakMap ` or ` WeakSet ` instances will result in inequality,
805
805
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
807
807
are not enumerable properties.
808
808
809
809
``` mjs
@@ -1029,7 +1029,7 @@ assert.deepStrictEqual(weakSet1, weakSet1);
1029
1029
If the values are not equal, an [ ` AssertionError ` ] [ ] is thrown with a ` message `
1030
1030
property set equal to the value of the ` message ` parameter. If the ` message `
1031
1031
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
1033
1033
` AssertionError ` .
1034
1034
1035
1035
## ` assert.doesNotMatch(string, regexp[, message]) `
@@ -1080,7 +1080,7 @@ If the values do match, or if the `string` argument is of another type than
1080
1080
` string ` , an [ ` AssertionError ` ] [ ] is thrown with a ` message ` property set equal
1081
1081
to the value of the ` message ` parameter. If the ` message ` parameter is
1082
1082
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
1084
1084
[ ` AssertionError ` ] [ ] .
1085
1085
1086
1086
## ` assert.doesNotReject(asyncFn[, error][, message]) `
@@ -1108,7 +1108,7 @@ benefit in catching a rejection and then rejecting it again. Instead, consider
1108
1108
adding a comment next to the specific code path that should not reject and keep
1109
1109
error messages as expressive as possible.
1110
1110
1111
- If specified, ` error ` can be a [ ` Class ` ] [ ] , [ ` RegExp ` ] [ ] , or a validation
1111
+ If specified, ` error ` can be a [ ` Class ` ] [ ] , { RegExp} or a validation
1112
1112
function. See [ ` assert.throws() ` ] [ ] for more details.
1113
1113
1114
1114
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
1190
1190
different type, or if the ` error ` parameter is undefined, the error is
1191
1191
propagated back to the caller.
1192
1192
1193
- If specified, ` error ` can be a [ ` Class ` ] [ ] , [ ` RegExp ` ] [ ] , or a validation
1193
+ If specified, ` error ` can be a [ ` Class ` ] [ ] , { RegExp} , or a validation
1194
1194
function. See [ ` assert.throws() ` ] [ ] for more details.
1195
1195
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
1197
1197
matching error type in the assertion:
1198
1198
1199
1199
``` mjs
@@ -1341,7 +1341,7 @@ assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
1341
1341
If the values are not equal, an [ ` AssertionError ` ] [ ] is thrown with a ` message `
1342
1342
property set equal to the value of the ` message ` parameter. If the ` message `
1343
1343
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
1345
1345
` AssertionError ` .
1346
1346
1347
1347
## ` assert.fail([message]) `
@@ -1353,7 +1353,7 @@ added: v0.1.21
1353
1353
* ` message ` {string|Error} ** Default:** ` 'Failed' `
1354
1354
1355
1355
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
1357
1357
it will be thrown instead of the [ ` AssertionError ` ] [ ] .
1358
1358
1359
1359
``` mjs
@@ -1605,7 +1605,7 @@ If the values do not match, or if the `string` argument is of another type than
1605
1605
` string ` , an [ ` AssertionError ` ] [ ] is thrown with a ` message ` property set equal
1606
1606
to the value of the ` message ` parameter. If the ` message ` parameter is
1607
1607
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
1609
1609
[ ` AssertionError ` ] [ ] .
1610
1610
1611
1611
## ` assert.notDeepEqual(actual, expected[, message]) `
@@ -1729,7 +1729,7 @@ assert.notDeepEqual(obj1, obj4);
1729
1729
If the values are deeply equal, an [ ` AssertionError ` ] [ ] is thrown with a
1730
1730
` message ` property set equal to the value of the ` message ` parameter. If the
1731
1731
` 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
1733
1733
instead of the ` AssertionError ` .
1734
1734
1735
1735
## ` assert.notDeepStrictEqual(actual, expected[, message]) `
@@ -1789,7 +1789,7 @@ assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
1789
1789
If the values are deeply and strictly equal, an [ ` AssertionError ` ] [ ] is thrown
1790
1790
with a ` message ` property set equal to the value of the ` message ` parameter. If
1791
1791
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
1793
1793
instead of the [ ` AssertionError ` ] [ ] .
1794
1794
1795
1795
## ` assert.notEqual(actual, expected[, message]) `
@@ -1853,7 +1853,7 @@ assert.notEqual(1, '1');
1853
1853
If the values are equal, an [ ` AssertionError ` ] [ ] is thrown with a ` message `
1854
1854
property set equal to the value of the ` message ` parameter. If the ` message `
1855
1855
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
1857
1857
` AssertionError ` .
1858
1858
1859
1859
## ` assert.notStrictEqual(actual, expected[, message]) `
@@ -1906,7 +1906,7 @@ assert.notStrictEqual(1, '1');
1906
1906
If the values are strictly equal, an [ ` AssertionError ` ] [ ] is thrown with a
1907
1907
` message ` property set equal to the value of the ` message ` parameter. If the
1908
1908
` 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
1910
1910
instead of the ` AssertionError ` .
1911
1911
1912
1912
## ` assert.ok(value[, message]) `
@@ -1929,7 +1929,7 @@ Tests if `value` is truthy. It is equivalent to
1929
1929
If ` value ` is not truthy, an [ ` AssertionError ` ] [ ] is thrown with a ` message `
1930
1930
property set equal to the value of the ` message ` parameter. If the ` message `
1931
1931
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
1933
1933
` AssertionError ` .
1934
1934
If no arguments are passed in at all ` message ` will be set to the string:
1935
1935
`` 'No value argument passed to `assert.ok()`' `` .
@@ -2050,7 +2050,7 @@ handler is skipped.
2050
2050
Besides the async nature to await the completion behaves identically to
2051
2051
[ ` assert.throws() ` ] [ ] .
2052
2052
2053
- If specified, ` error ` can be a [ ` Class ` ] [ ] , [ ` RegExp ` ] [ ] , a validation function,
2053
+ If specified, ` error ` can be a [ ` Class ` ] [ ] , { RegExp} , a validation function,
2054
2054
an object where each property will be tested for, or an instance of error where
2055
2055
each property will be tested for including the non-enumerable ` message ` and
2056
2056
` name ` properties.
@@ -2224,7 +2224,7 @@ assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
2224
2224
If the values are not strictly equal, an [ ` AssertionError ` ] [ ] is thrown with a
2225
2225
` message ` property set equal to the value of the ` message ` parameter. If the
2226
2226
` 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
2228
2228
instead of the [ ` AssertionError ` ] [ ] .
2229
2229
2230
2230
## ` assert.throws(fn[, error][, message]) `
@@ -2250,7 +2250,7 @@ changes:
2250
2250
2251
2251
Expects the function ` fn ` to throw an error.
2252
2252
2253
- If specified, ` error ` can be a [ ` Class ` ] [ ] , [ ` RegExp ` ] [ ] , a validation function,
2253
+ If specified, ` error ` can be a [ ` Class ` ] [ ] , { RegExp} , a validation function,
2254
2254
a validation object where each property will be tested for strict deep equality,
2255
2255
or an instance of error where each property will be tested for strict deep
2256
2256
equality including the non-enumerable ` message ` and ` name ` properties. When
@@ -2425,7 +2425,7 @@ assert.throws(
2425
2425
);
2426
2426
```
2427
2427
2428
- Validate error message using [ ` RegExp ` ] [ ] :
2428
+ Validate error message using { RegExp} :
2429
2429
2430
2430
Using a regular expression runs ` .toString ` on the error object, and will
2431
2431
therefore also include the error name.
@@ -2681,15 +2681,7 @@ assert.partialDeepStrictEqual({ a: { b: 2 } }, { a: { b: '2' } });
2681
2681
[ `Class` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
2682
2682
[ `ERR_INVALID_RETURN_VALUE` ] : errors.md#err_invalid_return_value
2683
2683
[ `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
2686
2684
[ `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
2693
2685
[ `assert.deepEqual()` ] : #assertdeepequalactual-expected-message
2694
2686
[ `assert.deepStrictEqual()` ] : #assertdeepstrictequalactual-expected-message
2695
2687
[ `assert.doesNotThrow()` ] : #assertdoesnotthrowfn-error-message
0 commit comments