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: nodejs/node#43919
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
(cherry picked from commit 2fd4c013c221653da2a7921d08fe1aa96aaba504)
  • Loading branch information
aduh95 committed Jul 21, 2022
1 parent 558abfc commit 93fbd06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/internal/main/test_runner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/nodejs/node/blob/389b7e138e89a339fabe4ad628bf09cd9748f957/lib/internal/main/test_runner.js
// https://github.com/nodejs/node/blob/2fd4c013c221653da2a7921d08fe1aa96aaba504/lib/internal/main/test_runner.js
'use strict'
const {
ArrayFrom,
Expand Down Expand Up @@ -116,7 +116,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 }),
toArray.call(child.stdout, { signal: t.signal }),
toArray.call(child.stderr, { signal: t.signal })
Expand Down
7 changes: 6 additions & 1 deletion test/parallel/test-runner-exit-code.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// https://github.com/nodejs/node/blob/1523a1817ed9b06fb51c0149451f9ea31bd2756e/test/parallel/test-runner-exit-code.js
// https://github.com/nodejs/node/blob/2fd4c013c221653da2a7921d08fe1aa96aaba504/test/parallel/test-runner-exit-code.js

'use strict'

const common = require('../common')
const fixtures = require('../common/fixtures')
const assert = require('assert')
const { spawnSync } = require('child_process')
const { promisify } = require('util')
Expand Down Expand Up @@ -32,6 +33,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 93fbd06

Please sign in to comment.