test: update startCLI to set --port=0 by default

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>
This commit is contained in:
Dario Piotrowicz
2025-07-20 18:37:28 +01:00
committed by GitHub
parent bf2384f224
commit 29626f8fb8
35 changed files with 43 additions and 41 deletions

View File

@@ -11,7 +11,7 @@ const assert = require('assert');
// Custom port.
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([`--port=${common.PORT}`, script]);
const cli = startCLI([`--port=${common.PORT}`, script], [], {}, { randomPort: false });
(async function() {
try {
await cli.waitForInitialBreak();

View File

@@ -9,7 +9,7 @@ const assert = require('assert');
// Launch CLI w/o args.
(async () => {
const cli = startCLI([]);
const cli = startCLI([], [], {}, { randomPort: false });
const code = await cli.quit();
assert.strictEqual(code, 9);
assert.match(cli.output, /^Usage:/, 'Prints usage info');
@@ -17,7 +17,7 @@ const assert = require('assert');
// Launch w/ invalid host:port.
(async () => {
const cli = startCLI([`localhost:${common.PORT}`]);
const cli = startCLI([`localhost:${common.PORT}`], [], {}, { randomPort: false });
const code = await cli.quit();
assert.match(
cli.output,

View File

@@ -8,7 +8,7 @@ import startCLI from '../common/debugger.js';
import assert from 'assert';
const script = path('debugger', 'three-lines.js');
const cli = startCLI([script]);
const cli = startCLI([script], [], {}, { randomPort: false });
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();

View File

@@ -13,7 +13,7 @@ const script = fixtures.path('debugger', 'alive.js');
const runTest = async () => {
const target = spawn(process.execPath, [script]);
const cli = startCLI(['-p', `${target.pid}`]);
const cli = startCLI(['-p', `${target.pid}`], [], {}, { randomPort: false });
try {
await cli.waitForPrompt();