mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

update the `startCLI` debugging testing utility to set by default the port to use to `0` (i.e. a random port) PR-URL: https://github.com/nodejs/node/pull/59042 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
37 lines
910 B
JavaScript
37 lines
910 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const assert = require('assert');
|
|
|
|
const RESTARTS = 10;
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const startCLI = require('../common/debugger');
|
|
|
|
// Using `restart` should result in only one "Connect/For help" message.
|
|
{
|
|
const script = fixtures.path('debugger', 'three-lines.js');
|
|
const cli = startCLI([script]);
|
|
|
|
const listeningRegExp = /Debugger listening on/g;
|
|
|
|
async function onWaitForInitialBreak() {
|
|
try {
|
|
await cli.waitForInitialBreak();
|
|
await cli.waitForPrompt();
|
|
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
|
|
|
|
for (let i = 0; i < RESTARTS; i++) {
|
|
await cli.stepCommand('restart');
|
|
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
|
|
}
|
|
} finally {
|
|
await cli.quit();
|
|
}
|
|
}
|
|
|
|
onWaitForInitialBreak();
|
|
}
|