Skip to content

Commit

Permalink
fix: remove stdout and stderr from error
Browse files Browse the repository at this point in the history
The CLI test runner parses the TAP output from child processes
now and displays it. This commit removes a previous workaround
for displaying child process stdout and stderr when tests
failures occurred.

PR-URL: nodejs/node#45592
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
(cherry picked from commit fec0fbc333c58e6ebbd2322f5120830fda880eb0)
  • Loading branch information
cjihrig authored and MoLow committed Feb 2, 2023
1 parent 6cd562d commit ddbce53
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/nodejs/node/blob/f8ce9117b19702487eb600493d941f7876e00e01/lib/internal/test_runner/runner.js
// https://github.com/nodejs/node/blob/fec0fbc333c58e6ebbd2322f5120830fda880eb0/lib/internal/test_runner/runner.js
'use strict'
const {
ArrayFrom,
Expand Down Expand Up @@ -225,18 +225,13 @@ function runTestFile (path, root, inspectPort, filesWatcher) {
const child = spawn(process.execPath, args, { signal: t.signal, encoding: 'utf8', env, stdio })

let err
let stderr = ''

filesWatcher?.watchChildProcessModules(child, path)

child.on('error', (error) => {
err = error
})

child.stderr.on('data', (data) => {
stderr += data
})

if (isUsingInspector()) {
const rl = createInterface({ input: child.stderr })
rl.on('line', (line) => {
Expand All @@ -257,7 +252,7 @@ function runTestFile (path, root, inspectPort, filesWatcher) {
subtest.addToReport(ast)
})

const { 0: { 0: code, 1: signal }, 1: stdout } = await SafePromiseAll([
const { 0: { 0: code, 1: signal } } = await SafePromiseAll([
once(child, 'exit', { signal: t.signal }),
toArray.call(child.stdout, { signal: t.signal })
])
Expand All @@ -268,8 +263,6 @@ function runTestFile (path, root, inspectPort, filesWatcher) {
__proto__: null,
exitCode: code,
signal,
stdout: ArrayPrototypeJoin(stdout, ''),
stderr,
// The stack will not be useful since the failures came from tests
// in a child process.
stack: undefined
Expand Down

0 comments on commit ddbce53

Please sign in to comment.