From fffeb384a7992597bb69cd471923535e115af0a8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 21 Jul 2022 13:40:21 +0200 Subject: [PATCH] test_runner: do not report an error when tests are passing PR-URL: https://github.com/nodejs/node/pull/43919 Reviewed-By: Mestery Reviewed-By: Colin Ihrig --- lib/internal/main/test_runner.js | 2 +- test/parallel/test-runner-exit-code.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/internal/main/test_runner.js b/lib/internal/main/test_runner.js index 595cd75ec1d..c1066cfca35 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 af9e29372e5..638ad9853ae 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);