Skip to content

Commit 2536e4f

Browse files
committed
test_runner: wait for stderr and stdout to complete
1 parent 71691e5 commit 2536e4f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/internal/main/test_runner.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ const {
77
ArrayPrototypeSlice,
88
ArrayPrototypeSort,
99
Promise,
10+
PromiseAll,
1011
SafeSet,
1112
} = primordials;
1213
const {
1314
prepareMainThreadExecution,
1415
} = require('internal/bootstrap/pre_execution');
1516
const { spawn } = require('child_process');
1617
const { readdirSync, statSync } = require('fs');
18+
const { finished } = require('internal/streams/end-of-stream');
1719
const console = require('internal/console/global');
1820
const {
1921
codes: {
@@ -126,9 +128,10 @@ function runTestFile(path) {
126128
stderr += chunk;
127129
});
128130

129-
child.once('exit', (code, signal) => {
131+
child.once('exit', async (code, signal) => {
130132
if (code !== 0 || signal !== null) {
131133
if (!err) {
134+
await PromiseAll([finished(child.stderr), finished(child.stdout)]);
132135
err = new ERR_TEST_FAILURE('test failed', kSubtestsFailed);
133136
err.exitCode = code;
134137
err.signal = signal;

0 commit comments

Comments
 (0)