Skip to content

Commit b0ed1e7

Browse files
Trottdanielleadams
authored andcommitted
test: improve error reporting in test-child-process-pipe-dataflow
When the test fails, it usually ends up failing on the assertion that `wc` did not find as many bytes as it expected. That may not be helpful if it is caused by a failure earlier in the command pipeline ( cat | grep | wc ). Move the byte check to `process.on('exit')` so that other error handlers that report the existence of errors run first. Refs: #25988 PR-URL: #37632 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 6192315 commit b0ed1e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/parallel/test-child-process-pipe-dataflow.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ const MB = KB * KB;
6666
wcBuf += data;
6767
}));
6868

69-
wc.on('close', common.mustCall(() => {
69+
process.on('exit', () => {
7070
// Grep always adds one extra byte at the end.
7171
assert.strictEqual(wcBuf.trim(), (MB + 1).toString());
72-
}));
72+
});
7373
}

0 commit comments

Comments
 (0)