Skip to content
Closed
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: fix child-process-pipe-dataflow
Make sure all the `wc` process stdout data is received before checking
its validity.

Fixes: #25988
  • Loading branch information
santigimeno committed Dec 3, 2020
commit f07cdd2cc7317a47870b3b15f1c3298a32883487
7 changes: 6 additions & 1 deletion test/parallel/test-child-process-pipe-dataflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ const MB = KB * KB;
}));
});

let wcBuf = '';
wc.stdout.on('data', common.mustCall((data) => {
wcBuf += data;
}));

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