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.

Refs: nodejs#30660
  • Loading branch information
addaleax committed Dec 7, 2019
1 parent 51ccf1b commit a118f9b
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 a118f9b

Please sign in to comment.