From a118f9bdd4216197330041b1a07799d7db63e317 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 7 Dec 2019 14:20:02 +0100 Subject: [PATCH] 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. Refs: https://github.com/nodejs/node/issues/30660 --- test/parallel/test-readline-async-iterators-destroy.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-readline-async-iterators-destroy.js b/test/parallel/test-readline-async-iterators-destroy.js index ea174d51723aa8..e96f831432b1eb 100644 --- a/test/parallel/test-readline-async-iterators-destroy.js +++ b/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'); } }