Skip to content

Commit

Permalink
test_runner: wait for stderr and stdout to complete
Browse files Browse the repository at this point in the history
PR-URL: #43666
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
MoLow authored and targos committed Jul 12, 2022
1 parent 1f4f811 commit e51d8c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/internal/main/test_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ const {
ArrayPrototypeSlice,
ArrayPrototypeSort,
Promise,
PromiseAll,
SafeArrayIterator,
SafeSet,
} = primordials;
const {
prepareMainThreadExecution,
} = require('internal/bootstrap/pre_execution');
const { spawn } = require('child_process');
const { readdirSync, statSync } = require('fs');
const { finished } = require('internal/streams/end-of-stream');
const console = require('internal/console/global');
const {
codes: {
Expand Down Expand Up @@ -126,9 +129,10 @@ function runTestFile(path) {
stderr += chunk;
});

child.once('exit', (code, signal) => {
child.once('exit', async (code, signal) => {
if (code !== 0 || signal !== null) {
if (!err) {
await PromiseAll(new SafeArrayIterator([finished(child.stderr), finished(child.stdout)]));
err = new ERR_TEST_FAILURE('test failed', kSubtestsFailed);
err.exitCode = code;
err.signal = signal;
Expand Down

0 comments on commit e51d8c6

Please sign in to comment.