Skip to content

Commit

Permalink
doc: fix missing imports in test.run code examples
Browse files Browse the repository at this point in the history
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: #49489
Fixes: #49488
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
OshriAsulin authored and ruyadorno committed Sep 28, 2023
1 parent 00608e8 commit f3fea92
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit f3fea92

Please sign in to comment.