Skip to content

Commit

Permalink
test_runner: do not report an error when tests are passing
Browse files Browse the repository at this point in the history
PR-URL: #43919
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
aduh95 authored and danielleadams committed Jul 26, 2022
1 parent 9c699bd commit 8b02485
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/main/test_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
5 changes: 5 additions & 0 deletions test/parallel/test-runner-exit-code.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8b02485

Please sign in to comment.