Skip to content

Commit

Permalink
doc: set exit code in custom test runner example
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <[email protected]>
PR-URL: #51056
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
mcollina authored and richardlau committed Mar 25, 2024
1 parent efd6630 commit 979e183
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -1173,8 +1173,11 @@ import process from 'node:process';
import path from 'node:path';

run({ files: [path.resolve('./tests/test.js')] })
.compose(tap)
.pipe(process.stdout);
.on('test:fail', () => {
process.exitCode = 1;
})
.compose(tap)
.pipe(process.stdout);
```

```cjs
Expand All @@ -1183,8 +1186,11 @@ const { run } = require('node:test');
const path = require('node:path');

run({ files: [path.resolve('./tests/test.js')] })
.compose(tap)
.pipe(process.stdout);
.on('test:fail', () => {
process.exitCode = 1;
})
.compose(tap)
.pipe(process.stdout);
```

## `test([name][, options][, fn])`
Expand Down

0 comments on commit 979e183

Please sign in to comment.