diff --git a/lib/internal/main/test_runner.js b/lib/internal/main/test_runner.js index 595cd75ec1dbdf..c1066cfca35323 100644 --- a/lib/internal/main/test_runner.js +++ b/lib/internal/main/test_runner.js @@ -114,7 +114,7 @@ function runTestFile(path) { err = error; }); - const { 0: { code, signal }, 1: stdout, 2: stderr } = await SafePromiseAll([ + const { 0: { 0: code, 1: signal }, 1: stdout, 2: stderr } = await SafePromiseAll([ once(child, 'exit', { signal: t.signal }), child.stdout.toArray({ signal: t.signal }), child.stderr.toArray({ signal: t.signal }), diff --git a/test/parallel/test-runner-exit-code.js b/test/parallel/test-runner-exit-code.js index af9e29372e5307..638ad9853aeefb 100644 --- a/test/parallel/test-runner-exit-code.js +++ b/test/parallel/test-runner-exit-code.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); +const fixtures = require('../common/fixtures'); const assert = require('assert'); const { spawnSync } = require('child_process'); const { setTimeout } = require('timers/promises'); @@ -28,6 +29,10 @@ if (process.argv[2] === 'child') { assert.strictEqual(child.status, 0); assert.strictEqual(child.signal, null); + child = spawnSync(process.execPath, ['--test', fixtures.path('test-runner', 'subdir', 'subdir_test.js')]); + assert.strictEqual(child.status, 0); + assert.strictEqual(child.signal, null); + child = spawnSync(process.execPath, [__filename, 'child', 'fail']); assert.strictEqual(child.status, 1); assert.strictEqual(child.signal, null);