diff --git a/doc/api/test.md b/doc/api/test.md index e6a1d22c972678..fc5b8ecdd2bd29 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -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 @@ -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])`