From 836ffe44a61bba1e720e84d31aaa28f46e68c3c3 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Wed, 4 Mar 2026 11:34:19 +0100 Subject: [PATCH 1/4] doc: fix markdown for `expectFailure` values --- doc/api/test.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/api/test.md b/doc/api/test.md index 76ffe2f215af90..ed3d91971b3732 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -288,15 +288,16 @@ it('should do the thing', { expectFailure: 'feature not implemented' }, () => { ``` If the value of `expectFailure` is a -[](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) | -[](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) | -[](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | -[](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), -the tests will pass only if they throw a matching value. -See [`assert.throws`][] for how each value type is handled. - -Each of the following tests fails _despite_ being flagged `expectFailure` -because the failure does not match the specific **expected** failure. +[`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp), +[`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function), +[`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), +or +[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), +the tests will pass only if they throw a matching value. See [`assert.throws`][] for how each value +type is handled. + +Each of the following tests fails _despite_ being flagged `expectFailure` because the failure does +not match the specific **expected** failure. ```js it('fails because regex does not match', { From 059bdf1d315e3bd536f5d176e6cd536464b4385d Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:44:48 +0100 Subject: [PATCH 2/4] leverage auto-linking md macro Co-authored-by: Antoine du Hamel --- doc/api/test.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/api/test.md b/doc/api/test.md index ed3d91971b3732..03a2b23b152fca 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -288,11 +288,7 @@ it('should do the thing', { expectFailure: 'feature not implemented' }, () => { ``` If the value of `expectFailure` is a -[`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp), -[`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function), -[`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), -or -[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), +{RegExp|Function|Object|Error} the tests will pass only if they throw a matching value. See [`assert.throws`][] for how each value type is handled. From 3540fae1006995da47addef94740f70ed227b253 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 4 Mar 2026 13:49:58 +0100 Subject: [PATCH 3/4] minimizing diff --- doc/api/test.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/api/test.md b/doc/api/test.md index 03a2b23b152fca..4c28bab9a4793c 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -287,13 +287,12 @@ it('should do the thing', { expectFailure: 'feature not implemented' }, () => { }); ``` -If the value of `expectFailure` is a -{RegExp|Function|Object|Error} -the tests will pass only if they throw a matching value. See [`assert.throws`][] for how each value -type is handled. +If the value of `expectFailure` is a {RegExp|Function|Object|Error} +the tests will pass only if they throw a matching value. +See [`assert.throws`][] for how each value type is handled. -Each of the following tests fails _despite_ being flagged `expectFailure` because the failure does -not match the specific **expected** failure. +Each of the following tests fails _despite_ being flagged `expectFailure` +because the failure does not match the specific **expected** failure. ```js it('fails because regex does not match', { From 1cc3b2237f2cac2736ce55aabc0ce6f11d745599 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:57:08 +0100 Subject: [PATCH 4/4] apply md macro to other set of types links --- doc/api/test.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/api/test.md b/doc/api/test.md index 4c28bab9a4793c..c526aec69735d9 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -1730,11 +1730,7 @@ changes: **Default:** `false`. * `expectFailure` {boolean|string|RegExp|Function|Object|Error} If truthy, the test is expected to fail. If a non-empty string is provided, that string is displayed - in the test results as the reason why the test is expected to fail. If a - [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp), - [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function), - [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object), or - [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + in the test results as the reason why the test is expected to fail. If a {RegExp|Function|Object|Error} is provided directly (without wrapping in `{ match: … }`), the test passes only if the thrown error matches, following the behavior of [`assert.throws`][]. To provide both a reason and validation, pass an object