Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
  • Loading branch information
Trott committed Mar 9, 2021
commit 7f54dd4f0704c73f48a2377e16a8e537a83b45da
4 changes: 2 additions & 2 deletions test/parallel/test-child-process-pipe-dataflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const MB = KB * KB;
wcBuf += data;
}));

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