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>
35 lines
860 B
JavaScript
35 lines
860 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const startCLI = require('../common/debugger');
|
|
|
|
const assert = require('assert');
|
|
const { spawn } = require('child_process');
|
|
|
|
const script = fixtures.path('debugger', 'alive.js');
|
|
|
|
const runTest = async () => {
|
|
const target = spawn(process.execPath, [script]);
|
|
const cli = startCLI(['-p', `${target.pid}`], [], {}, { randomPort: false });
|
|
|
|
try {
|
|
await cli.waitForPrompt();
|
|
await cli.command('sb("alive.js", 3)');
|
|
await cli.waitFor(/break/);
|
|
await cli.waitForPrompt();
|
|
assert.match(
|
|
cli.output,
|
|
/> 3 {3}\+\+x;/,
|
|
'marks the 3rd line');
|
|
} catch (error) {
|
|
assert.ifError(error);
|
|
} finally {
|
|
await cli.quit();
|
|
target.kill();
|
|
}
|
|
};
|
|
|
|
runTest().then(common.mustCall());
|