From 793d8719ebcb67e2758ba7fd6c50ff864d552716 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Sat, 17 Dec 2016 09:01:47 +0100 Subject: [PATCH] test: fix flaky test-debug-port It can happen that first data chunk received in stdout is not exactly `'debug> '`. Make sure the exit condition is met. PR-URL: https://github.com/nodejs/node/pull/10316 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Italo A. Casas --- test/parallel/test-debug-prompt.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-debug-prompt.js b/test/parallel/test-debug-prompt.js index fdc3b4c27f4d45..82120859c7ca8a 100644 --- a/test/parallel/test-debug-prompt.js +++ b/test/parallel/test-debug-prompt.js @@ -1,13 +1,14 @@ 'use strict'; -const assert = require('assert'); -const common = require('../common'); +require('../common'); const spawn = require('child_process').spawn; const proc = spawn(process.execPath, ['debug', 'foo']); proc.stdout.setEncoding('utf8'); -proc.stdout.once('data', common.mustCall((data) => { - assert.strictEqual(data, 'debug> '); - proc.kill(); -})); +let output = ''; +proc.stdout.on('data', (data) => { + output += data; + if (output.includes('debug> ')) + proc.kill(); +});