Skip to content

Commit ce21fc7

Browse files
addaleaxtargos
authored andcommitted
test: wait for stream close before writing to file
Wait for async operations on a file to finish before writing to it again. This fixes flakiness in parallel/test-readline-async-iterators-destroy. PR-URL: #30836 Fixes: #30660 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 78eaf50 commit ce21fc7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/parallel/test-readline-async-iterators-destroy.js

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const common = require('../common');
44
const fs = require('fs');
5+
const { once } = require('events');
56
const { join } = require('path');
67
const readline = require('readline');
78
const assert = require('assert');
@@ -45,6 +46,8 @@ async function testSimpleDestroy() {
4546

4647
rli.close();
4748
readable.destroy();
49+
50+
await once(readable, 'close');
4851
}
4952
}
5053

@@ -78,6 +81,8 @@ async function testMutualDestroy() {
7881

7982
rli.close();
8083
readable.destroy();
84+
85+
await once(readable, 'close');
8186
}
8287
}
8388

0 commit comments

Comments
 (0)