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 danielleadams committed Apr 24, 2022
1 parent bd48ad9 commit 978b50f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/parallel/test-common-expect-warning.js
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 978b50f

Please sign in to comment.