Skip to content

Commit 5bffe11

Browse files
addaleaxBethGriggs
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: #30836Fixes: #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 578d12f commit 5bffe11

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
constcommon=require('../common');
44
constfs=require('fs');
5+
const{ once }=require('events');
56
const{ join }=require('path');
67
constreadline=require('readline');
78
constassert=require('assert');
@@ -42,6 +43,11 @@ async function testSimpleDestroy(){
4243
expectedLines.splice(1);
4344

4445
assert.deepStrictEqual(iteratedLines,expectedLines);
46+
47+
rli.close();
48+
readable.destroy();
49+
50+
awaitonce(readable,'close');
4551
}
4652
}
4753

@@ -72,6 +78,11 @@ async function testMutualDestroy(){
7278
}
7379

7480
assert.deepStrictEqual(iteratedLines,expectedLines);
81+
82+
rli.close();
83+
readable.destroy();
84+
85+
awaitonce(readable,'close');
7586
}
7687
}
7788

0 commit comments

Comments
(0)