node/test/sequential/test-debugger-pid.js
Antoine du Hamel 646e19e2b4
test: ensure assertions are reachable in test/sequential
PR-URL: https://github.com/nodejs/node/pull/60412
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-10-29 16:29:39 +01:00

32 lines
789 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');
(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');
} finally {
await cli.quit();
target.kill();
}
})().then(common.mustCall());