Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8040d8b

Browse filesBrowse files
Trotttargos
authored andcommitted
test: increase debugging information on failure
Increase the information displayed when test-child-process-pipe-dataflow.js fails. PR-URL: #27790 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 588fd0c commit 8040d8b
Copy full SHA for 8040d8b

File tree

Expand file treeCollapse file tree

1 file changed

+9
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-6
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-pipe-dataflow.js
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@ const MB = KB * KB;
3838
grep.stdout._handle.readStart = common.mustNotCall();
3939

4040
[cat, grep, wc].forEach((child, index) => {
41-
child.stderr.on('data', (d) => {
41+
const errorHandler = (thing, type) => {
4242
// Don't want to assert here, as we might miss error code info.
43-
console.error(`got unexpected data from child #${index}:\n${d}`);
44-
});
45-
child.on('exit', common.mustCall(function(code) {
46-
assert.strictEqual(code, 0);
43+
console.error(`unexpected ${type} from child #${index}:\n${thing}`);
44+
};
45+
46+
child.stderr.on('data', (d) => { errorHandler(d, 'data'); });
47+
child.on('error', (err) => { errorHandler(err, 'error'); });
48+
child.on('exit', common.mustCall((code) => {
49+
assert.strictEqual(code, 0, `child ${index} exited with code ${code}`);
4750
}));
4851
});
4952

50-
wc.stdout.on('data', common.mustCall(function(data) {
53+
wc.stdout.on('data', common.mustCall((data) => {
5154
assert.strictEqual(data.toString().trim(), MB.toString());
5255
}));
5356
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.