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
  • Loading branch information
MoLow committed Jul 3, 2022
1 parent 71691e5 commit 97b5953
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/internal/main/test_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ const {
ArrayPrototypeSlice,
ArrayPrototypeSort,
Promise,
PromiseAll,
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 +128,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([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 97b5953

Please sign in to comment.