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 Sep 6, 2023
1 parent fdc65d9 commit 6919d72
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 @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 6919d72

Please sign in to comment.