| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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: | |
@@ -623,23 +623,23 @@ are also recursively evaluated by the following rules. | |||
| 623 | 623 | ### Comparison details | |
| 624 | 624 | ||
| 625 | 625 | * 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}. | ||
| 628 | 628 | * [Type tags][Object.prototype.toString()] of objects should be the same. | |
| 629 | 629 | * 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, | ||
| 631 | 631 | even if these are not enumerable properties. | |
| 632 | 632 | * [Object wrappers][] are compared both as objects and unwrapped values. | |
| 633 | 633 | * `Object` properties are compared unordered. | |
| 634 | - * [`Map`][] keys and [`Set`][] items are compared unordered. | ||
| 634 | + * {Map} keys and {Set} items are compared unordered. | ||
| 635 | 635 | * Recursion stops when both sides differ or both sides encounter a circular | |
| 636 | 636 | reference. | |
| 637 | 637 | * Implementation does not test the [`[[Prototype]]`][prototype-spec] of | |
| 638 | 638 | 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 | ||
| 641 | 641 | 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 | ||
| 643 | 643 | are not enumerable properties. | |
| 644 | 644 | ||
| 645 | 645 | The following example does not throw an [`AssertionError`][] because the | |
@@ -735,7 +735,7 @@ assert.deepEqual(obj1, obj4); | |||
| 735 | 735 | If the values are not equal, an [`AssertionError`][] is thrown with a `message` | |
| 736 | 736 | property set equal to the value of the `message` parameter. If the `message` | |
| 737 | 737 | 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 | ||
| 739 | 739 | [`AssertionError`][]. | |
| 740 | 740 | ||
| 741 | 741 | ## `assert.deepStrictEqual(actual, expected[, message])` | |
@@ -795,20 +795,20 @@ are recursively evaluated also by the following rules. | |||
| 795 | 795 | * [`[[Prototype]]`][prototype-spec] of objects are compared using | |
| 796 | 796 | the [`===` operator][]. | |
| 797 | 797 | * 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, | ||
| 799 | 799 | even if these are not enumerable properties. | |
| 800 | 800 | `errors` is also compared. | |
| 801 | - * Enumerable own [`Symbol`][] properties are compared as well. | ||
| 801 | + * Enumerable own {Symbol} properties are compared as well. | ||
| 802 | 802 | * [Object wrappers][] are compared both as objects and unwrapped values. | |
| 803 | 803 | * `Object` properties are compared unordered. | |
| 804 | - * [`Map`][] keys and [`Set`][] items are compared unordered. | ||
| 804 | + * {Map} keys and {Set} items are compared unordered. | ||
| 805 | 805 | * Recursion stops when both sides differ or both sides encounter a circular | |
| 806 | 806 | reference. | |
| 807 | - * [`WeakMap`][] and [`WeakSet`][] instances are **not** compared structurally. | ||
| 807 | + * {WeakMap} and {WeakSet} instances are **not** compared structurally. | ||
| 808 | 808 | They are only equal if they reference the same object. Any comparison between | |
| 809 | 809 | different `WeakMap` or `WeakSet` instances will result in inequality, | |
| 810 | 810 | 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 | ||
| 812 | 812 | are not enumerable properties. | |
| 813 | 813 | ||
| 814 | 814 | ```mjs | |
@@ -1034,7 +1034,7 @@ assert.deepStrictEqual(weakSet1, weakSet1); | |||
| 1034 | 1034 | If the values are not equal, an [`AssertionError`][] is thrown with a `message` | |
| 1035 | 1035 | property set equal to the value of the `message` parameter. If the `message` | |
| 1036 | 1036 | 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 | ||
| 1038 | 1038 | `AssertionError`. | |
| 1039 | 1039 | ||
| 1040 | 1040 | ## `assert.doesNotMatch(string, regexp[, message])` | |
@@ -1085,7 +1085,7 @@ If the values do match, or if the `string` argument is of another type than | |||
| 1085 | 1085 | `string`, an [`AssertionError`][] is thrown with a `message` property set equal | |
| 1086 | 1086 | to the value of the `message` parameter. If the `message` parameter is | |
| 1087 | 1087 | 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 | ||
| 1089 | 1089 | [`AssertionError`][]. | |
| 1090 | 1090 | ||
| 1091 | 1091 | ## `assert.doesNotReject(asyncFn[, error][, message])` | |
@@ -1113,7 +1113,7 @@ benefit in catching a rejection and then rejecting it again. Instead, consider | |||
| 1113 | 1113 | adding a comment next to the specific code path that should not reject and keep | |
| 1114 | 1114 | error messages as expressive as possible. | |
| 1115 | 1115 | ||
| 1116 | - If specified, `error` can be a [`Class`][], [`RegExp`][], or a validation | ||
| 1116 | + If specified, `error` can be a [`Class`][], {RegExp} or a validation | ||
| 1117 | 1117 | function. See [`assert.throws()`][] for more details. | |
| 1118 | 1118 | ||
| 1119 | 1119 | 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 | |||
| 1195 | 1195 | different type, or if the `error` parameter is undefined, the error is | |
| 1196 | 1196 | propagated back to the caller. | |
| 1197 | 1197 | ||
| 1198 | - If specified, `error` can be a [`Class`][], [`RegExp`][], or a validation | ||
| 1198 | + If specified, `error` can be a [`Class`][], {RegExp}, or a validation | ||
| 1199 | 1199 | function. See [`assert.throws()`][] for more details. | |
| 1200 | 1200 | ||
| 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 | ||
| 1202 | 1202 | matching error type in the assertion: | |
| 1203 | 1203 | ||
| 1204 | 1204 | ```mjs | |
@@ -1346,7 +1346,7 @@ assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); | |||
| 1346 | 1346 | If the values are not equal, an [`AssertionError`][] is thrown with a `message` | |
| 1347 | 1347 | property set equal to the value of the `message` parameter. If the `message` | |
| 1348 | 1348 | 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 | ||
| 1350 | 1350 | `AssertionError`. | |
| 1351 | 1351 | ||
| 1352 | 1352 | ## `assert.fail([message])` | |
@@ -1358,7 +1358,7 @@ added: v0.1.21 | |||
| 1358 | 1358 | * `message` {string|Error} **Default:** `'Failed'` | |
| 1359 | 1359 | ||
| 1360 | 1360 | 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 | ||
| 1362 | 1362 | it will be thrown instead of the [`AssertionError`][]. | |
| 1363 | 1363 | ||
| 1364 | 1364 | ```mjs | |
@@ -1610,7 +1610,7 @@ If the values do not match, or if the `string` argument is of another type than | |||
| 1610 | 1610 | `string`, an [`AssertionError`][] is thrown with a `message` property set equal | |
| 1611 | 1611 | to the value of the `message` parameter. If the `message` parameter is | |
| 1612 | 1612 | 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 | ||
| 1614 | 1614 | [`AssertionError`][]. | |
| 1615 | 1615 | ||
| 1616 | 1616 | ## `assert.notDeepEqual(actual, expected[, message])` | |
@@ -1734,7 +1734,7 @@ assert.notDeepEqual(obj1, obj4); | |||
| 1734 | 1734 | If the values are deeply equal, an [`AssertionError`][] is thrown with a | |
| 1735 | 1735 | `message` property set equal to the value of the `message` parameter. If the | |
| 1736 | 1736 | `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 | ||
| 1738 | 1738 | instead of the `AssertionError`. | |
| 1739 | 1739 | ||
| 1740 | 1740 | ## `assert.notDeepStrictEqual(actual, expected[, message])` | |
@@ -1794,7 +1794,7 @@ assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); | |||
| 1794 | 1794 | If the values are deeply and strictly equal, an [`AssertionError`][] is thrown | |
| 1795 | 1795 | with a `message` property set equal to the value of the `message` parameter. If | |
| 1796 | 1796 | 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 | ||
| 1798 | 1798 | instead of the [`AssertionError`][]. | |
| 1799 | 1799 | ||
| 1800 | 1800 | ## `assert.notEqual(actual, expected[, message])` | |
@@ -1858,7 +1858,7 @@ assert.notEqual(1, '1'); | |||
| 1858 | 1858 | If the values are equal, an [`AssertionError`][] is thrown with a `message` | |
| 1859 | 1859 | property set equal to the value of the `message` parameter. If the `message` | |
| 1860 | 1860 | 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 | ||
| 1862 | 1862 | `AssertionError`. | |
| 1863 | 1863 | ||
| 1864 | 1864 | ## `assert.notStrictEqual(actual, expected[, message])` | |
@@ -1911,7 +1911,7 @@ assert.notStrictEqual(1, '1'); | |||
| 1911 | 1911 | If the values are strictly equal, an [`AssertionError`][] is thrown with a | |
| 1912 | 1912 | `message` property set equal to the value of the `message` parameter. If the | |
| 1913 | 1913 | `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 | ||
| 1915 | 1915 | instead of the `AssertionError`. | |
| 1916 | 1916 | ||
| 1917 | 1917 | ## `assert.ok(value[, message])` | |
@@ -1934,7 +1934,7 @@ Tests if `value` is truthy. It is equivalent to | |||
| 1934 | 1934 | If `value` is not truthy, an [`AssertionError`][] is thrown with a `message` | |
| 1935 | 1935 | property set equal to the value of the `message` parameter. If the `message` | |
| 1936 | 1936 | 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 | ||
| 1938 | 1938 | `AssertionError`. | |
| 1939 | 1939 | If no arguments are passed in at all `message` will be set to the string: | |
| 1940 | 1940 | ``'No value argument passed to `assert.ok()`'``. | |
@@ -2055,7 +2055,7 @@ handler is skipped. | |||
| 2055 | 2055 | Besides the async nature to await the completion behaves identically to | |
| 2056 | 2056 | [`assert.throws()`][]. | |
| 2057 | 2057 | ||
| 2058 | - If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function, | ||
| 2058 | + If specified, `error` can be a [`Class`][], {RegExp}, a validation function, | ||
| 2059 | 2059 | an object where each property will be tested for, or an instance of error where | |
| 2060 | 2060 | each property will be tested for including the non-enumerable `message` and | |
| 2061 | 2061 | `name` properties. | |
@@ -2229,7 +2229,7 @@ assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); | |||
| 2229 | 2229 | If the values are not strictly equal, an [`AssertionError`][] is thrown with a | |
| 2230 | 2230 | `message` property set equal to the value of the `message` parameter. If the | |
| 2231 | 2231 | `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 | ||
| 2233 | 2233 | instead of the [`AssertionError`][]. | |
| 2234 | 2234 | ||
| 2235 | 2235 | ## `assert.throws(fn[, error][, message])` | |
@@ -2255,7 +2255,7 @@ changes: | |||
| 2255 | 2255 | ||
| 2256 | 2256 | Expects the function `fn` to throw an error. | |
| 2257 | 2257 | ||
| 2258 | - If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function, | ||
| 2258 | + If specified, `error` can be a [`Class`][], {RegExp}, a validation function, | ||
| 2259 | 2259 | a validation object where each property will be tested for strict deep equality, | |
| 2260 | 2260 | or an instance of error where each property will be tested for strict deep | |
| 2261 | 2261 | equality including the non-enumerable `message` and `name` properties. When | |
@@ -2430,7 +2430,7 @@ assert.throws( | |||
| 2430 | 2430 | ); | |
| 2431 | 2431 | ``` | |
| 2432 | 2432 | ||
| 2433 | - Validate error message using [`RegExp`][]: | ||
| 2433 | + Validate error message using {RegExp}: | ||
| 2434 | 2434 | ||
| 2435 | 2435 | Using a regular expression runs `.toString` on the error object, and will | |
| 2436 | 2436 | therefore also include the error name. | |
@@ -2686,15 +2686,7 @@ assert.partialDeepStrictEqual({ a: { b: 2 } }, { a: { b: '2' } }); | |||
| 2686 | 2686 | [`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes | |
| 2687 | 2687 | [`ERR_INVALID_RETURN_VALUE`]: errors.md#err_invalid_return_value | |
| 2688 | 2688 | [`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 | ||
| 2691 | 2689 | [`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 | ||
| 2698 | 2690 | [`assert.deepEqual()`]: #assertdeepequalactual-expected-message | |
| 2699 | 2691 | [`assert.deepStrictEqual()`]: #assertdeepstrictequalactual-expected-message | |
| 2700 | 2692 | [`assert.doesNotThrow()`]: #assertdoesnotthrowfn-error-message | |
| Back | FazBrowse Home | New Git URL |
0 commit comments