Skip to content

Commit d0f68a3

Browse files
lpincasxa
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 <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent f107f8b commit d0f68a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

+3-1
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)