From b5a75baa5bc879cbd4a2c5885fb75be8605abae3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 12 May 2016 22:21:48 -0700 Subject: [PATCH] test: fix flaky test-preload Use `close` event rather than `exit` event to make sure all output has been received before checking assertions. PR-URL: https://github.com/nodejs/node/pull/6728 Fixes: https://github.com/nodejs/node/issues/6722 Reviewed-By: Santiago Gimeno Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: Anna Henningsen --- test/parallel/test-preload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 6bb82b523f8985..71019b6e01c03a 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -81,7 +81,7 @@ var stdinStdout = ''; stdinProc.stdout.on('data', function(d) { stdinStdout += d; }); -stdinProc.on('exit', function(code) { +stdinProc.on('close', function(code) { assert.equal(code, 0); assert.equal(stdinStdout, 'A\nhello\n'); }); @@ -97,7 +97,7 @@ var replStdout = ''; replProc.stdout.on('data', function(d) { replStdout += d; }); -replProc.on('exit', function(code) { +replProc.on('close', function(code) { assert.equal(code, 0); const output = [ 'A',