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 RafaelGSS committed Jan 2, 2024
1 parent d7c2572 commit 5453abd
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 @@ -1154,8 +1154,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 @@ -1164,8 +1167,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 5453abd

Please sign in to comment.