Skip to content
Permalink
Browse files

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 <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 7, 2019
1 parent a4e7ea8 commit b7d87e31f5add8e7bc93f6bcb32f01bc947206c4
Showing with 5 additions and 0 deletions.
  1. +5 −0 test/parallel/test-readline-async-iterators-destroy.js
@@ -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');
@@ -45,6 +46,8 @@ async function testSimpleDestroy() {

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

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

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

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

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

0 comments on commit b7d87e3

Please sign in to comment.
You can’t perform that action at this time.