node/test/parallel/test-debugger-scripts.js
Dario Piotrowicz 29626f8fb8
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>
2025-07-20 17:37:28 +00:00

42 lines
1.1 KiB
JavaScript

'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');
const assert = require('assert');
// List scripts.
{
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);
(async () => {
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
await cli.command('scripts');
assert.match(
cli.output,
/^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
'lists the user script');
assert.doesNotMatch(
cli.output,
/\d+: node:internal\/buffer/,
'omits node-internal scripts');
await cli.command('scripts(true)');
assert.match(
cli.output,
/\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
'lists the user script');
assert.match(
cli.output,
/\d+: node:internal\/buffer/,
'includes node-internal scripts');
} finally {
await cli.quit();
}
})().then(common.mustCall());
}