Skip to content

Commit

Permalink
test: wait for stream close before writing to file
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
addaleax authored and targos committed Dec 11, 2019
1 parent 78eaf50 commit ce21fc7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-readline-async-iterators-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const common = require('../common');
const fs = require('fs');
const { once } = require('events');
const { join } = require('path');
const readline = require('readline');
const assert = require('assert');
Expand Down Expand Up @@ -45,6 +46,8 @@ async function testSimpleDestroy() {

rli.close();
readable.destroy();

await once(readable, 'close');
}
}

Expand Down Expand Up @@ -78,6 +81,8 @@ async function testMutualDestroy() {

rli.close();
readable.destroy();

await once(readable, 'close');
}
}

Expand Down

0 comments on commit ce21fc7

Please sign in to comment.