From b8eed1e61eef7a964462b31e31474bf98f3fc09d Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Sat, 12 Dec 2015 15:29:18 +0100 Subject: [PATCH] test: fix debug-port-cluster flakiness The test was assuming that the 'all workers are running' text was received by the parent process in a separate chunk from the other texts. This might not always be the case, causing the test never reaches the exit condition. Fix it by checking every line received. --- test/parallel/test-debug-port-cluster.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-debug-port-cluster.js b/test/parallel/test-debug-port-cluster.js index 5bec9dc720599e..a4265f38c9ad0f 100644 --- a/test/parallel/test-debug-port-cluster.js +++ b/test/parallel/test-debug-port-cluster.js @@ -17,14 +17,15 @@ child.stderr.on('data', function(data) { var lines = data.toString().replace(/\r/g, '').trim().split('\n'); var line = lines[0]; - lines.forEach(function(ln) { console.log('> ' + ln); } ); - - if (line === 'all workers are running') { - assertOutputLines(); - process.exit(); - } else { - outputLines = outputLines.concat(lines); - } + lines.forEach((ln, i) => { + console.log(i + '> ' + ln); + if (ln === 'all workers are running') { + assertOutputLines(); + process.exit(); + } else { + outputLines.push(ln); + } + }); }); process.on('exit', function onExit() {