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 <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
addaleax committed Dec 10, 2019
1 parent a4e7ea8 commit b7d87e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-readline-async-iterators-destroy.js
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 b7d87e3

Please sign in to comment.