Skip to content

Commit 793d871

Browse files
committed
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: #10316 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
1 parent 5d14602 commit 793d871

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/parallel/test-debug-prompt.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
'use strict';
22

3-
const assert = require('assert');
4-
const common = require('../common');
3+
require('../common');
54
const spawn = require('child_process').spawn;
65

76
const proc = spawn(process.execPath, ['debug', 'foo']);
87
proc.stdout.setEncoding('utf8');
98

10-
proc.stdout.once('data', common.mustCall((data) => {
11-
assert.strictEqual(data, 'debug> ');
12-
proc.kill();
13-
}));
9+
let output = '';
10+
proc.stdout.on('data', (data) => {
11+
output += data;
12+
if (output.includes('debug> '))
13+
proc.kill();
14+
});

0 commit comments

Comments
 (0)