Skip to content

Commit afc52f4

Browse files
committed
test_runner: wait for parser to finish
1 parent b4a962d commit afc52f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/internal/test_runner/runner.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const {
1313
ObjectAssign,
1414
ObjectKeys,
1515
PromisePrototypeThen,
16+
SafePromiseAll,
1617
SafePromiseAllReturnVoid,
1718
SafePromiseAllSettledReturnVoid,
1819
SafeMap,
@@ -24,6 +25,7 @@ const {
2425

2526
const { spawn } = require('child_process');
2627
const { readdirSync, statSync } = require('fs');
28+
const { finished } = require('internal/streams/end-of-stream');
2729
// TODO(aduh95): switch to internal/readline/interface when backporting to Node.js 16.x is no longer a concern.
2830
const { createInterface } = require('readline');
2931
const { FilesWatcher } = require('internal/watch_mode/files_watcher');
@@ -299,7 +301,10 @@ function runTestFile(path, root, inspectPort, filesWatcher) {
299301
subtest.addToReport(ast);
300302
});
301303

302-
const { 0: code, 1: signal } = await once(child, 'exit', { signal: t.signal });
304+
const { 0: { 0: code, 1: signal } } = await SafePromiseAll([
305+
once(child, 'exit', { signal: t.signal }),
306+
finished(parser, { signal: t.signal }),
307+
]);
303308

304309
runningProcesses.delete(path);
305310
runningSubtests.delete(path);

0 commit comments

Comments
 (0)