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 <hello@matteocollina.com>
PR-URL: #51056
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • 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
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.