From 6919d7241657517bfff6d2041748fa9f8e85b76e Mon Sep 17 00:00:00 2001 From: Oshri Asulin <114335827+OshriAsulin@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:17:54 +0300 Subject: [PATCH] doc: fix missing imports in `test.run` code examples The script was missing necessary imports for the `run` function and the `path` module, causing it to fail. This commit adds the missing imports and resolves the issue. - Import `run` from the appropriate module. - Import `path` to resolve file paths. The script should now run without errors. PR-URL: https://github.com/nodejs/node/pull/49489 Fixes: https://github.com/nodejs/node/issues/49488 Reviewed-By: Chemi Atlow Reviewed-By: Antoine du Hamel --- doc/api/test.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/test.md b/doc/api/test.md index ab58bf0e312654..cbc7083bbbd0ec 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -908,7 +908,9 @@ changes: ```mjs import { tap } from 'node:test/reporters'; +import { run } from 'node:test'; import process from 'node:process'; +import path from 'node:path'; run({ files: [path.resolve('./tests/test.js')] }) .compose(tap) @@ -917,6 +919,8 @@ run({ files: [path.resolve('./tests/test.js')] }) ```cjs const { tap } = require('node:test/reporters'); +const { run } = require('node:test'); +const path = require('node:path'); run({ files: [path.resolve('./tests/test.js')] }) .compose(tap)