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 <chemi@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Oshri Asulin authored and Ruy Adorno committed 2023-09-27 22:20:16 -04:00
1 parent 00608e8070
commit f3fea92f8a
1 file changed
+4
+4
View File
@@ -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)