Skip to content

Commit 978b50f

Browse files
lpincadanielleadams
authored andcommitted
test: deflake test-common-expect-warning
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>
1 parent bd48ad9 commit 978b50f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/parallel/test-common-expect-warning.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ if (process.argv[2] !== 'child') {
3636
child.stderr.on('data', (data) => {
3737
stderr += data;
3838
});
39+
child.stderr.on('end', common.mustCall(() => {
40+
assert.match(stderr, /Unexpected extra warning received/);
41+
}));
3942
child.on('exit', common.mustCall((status) => {
4043
assert.notStrictEqual(status, 0);
41-
assert.match(stderr, /Unexpected extra warning received/);
4244
}));
4345
}
4446
} else {

0 commit comments

Comments
 (0)