From 6975dd14253e936509e2a68b293101fa234e53af Mon Sep 17 00:00:00 2001 From: Wassim Chegham Date: Thu, 9 Jun 2022 12:23:40 +0200 Subject: [PATCH] doc: add code examples to node test runner PR-URL: https://github.com/nodejs/node/pull/43359 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Akhil Marsonya Reviewed-By: Harshitha K P Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann Reviewed-By: Rich Trott Co-authored-by: Antoine du Hamel --- doc/api/test.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/doc/api/test.md b/doc/api/test.md index 7513dc24e26afd..52620899191142 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -357,6 +357,12 @@ This function is used to write TAP diagnostics to the output. Any diagnostic information is included at the end of the test's results. This function does not return a value. +```js +test('top level test', (t) => { + t.diagnostic('A diagnostic message'); +}); +``` + ### `context.runOnly(shouldRunOnlyTests)`