Skip to content

Commit bf9a824

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 c3daa3e commit bf9a824

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

+11
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');
@@ -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+
await once(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+
await once(readable, 'close');
7586
}
7687
}
7788

0 commit comments

Comments
 (0)