From f3fea92f8a1aae7871ec72d65e7ef83c16e44da8 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 61a2da1bf1b870..4ba66d408131b8 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -927,7 +927,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) @@ -936,6 +938,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)