Skip to content

Commit

Permalink
test: deflake test-common-expect-warning
Browse files Browse the repository at this point in the history
The subprocess might exit before the data is flushed. Run the assertion
after the `'end'` event is emitted.
  • Loading branch information
lpinca committed Feb 20, 2022
1 parent 53364a2 commit 7830a0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/parallel/test-common-expect-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ if (process.argv[2] !== 'child') {
child.stderr.on('data', (data) => {
stderr += data;
});
child.stderr.on('end', common.mustCall(() => {
assert.match(stderr, /Unexpected extra warning received/);
}));
child.on('exit', common.mustCall((status) => {
assert.notStrictEqual(status, 0);
assert.match(stderr, /Unexpected extra warning received/);
}));
}
} else {
Expand Down

0 comments on commit 7830a0b

Please sign in to comment.