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.

PR-URL: #42046
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
lpinca authored and sxa committed Mar 7, 2022
1 parent f107f8b commit d0f68a3
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 d0f68a3

Please sign in to comment.