mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

When I moved node-inspect into core, I called a lot of things `inspector-cli` that really should have been `debugger`. This is the last of them to be renamed. PR-URL: https://github.com/nodejs/node/pull/39156 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const startCLI = require('../common/debugger');
|
|
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
|
|
// Using sb before loading file.
|
|
{
|
|
const scriptFullPath = fixtures.path('debugger', 'cjs', 'index.js');
|
|
const script = path.relative(process.cwd(), scriptFullPath);
|
|
|
|
const otherScriptFullPath = fixtures.path('debugger', 'cjs', 'other.js');
|
|
const otherScript = path.relative(process.cwd(), otherScriptFullPath);
|
|
|
|
const cli = startCLI([script]);
|
|
|
|
function onFatal(error) {
|
|
cli.quit();
|
|
throw error;
|
|
}
|
|
|
|
cli.waitForInitialBreak()
|
|
.then(() => cli.waitForPrompt())
|
|
.then(() => cli.command('sb("other.js", 2)'))
|
|
.then(() => {
|
|
assert.match(
|
|
cli.output,
|
|
/not loaded yet/,
|
|
'warns that the script was not loaded yet');
|
|
})
|
|
.then(() => cli.stepCommand('cont'))
|
|
.then(() => {
|
|
assert.ok(
|
|
cli.output.includes(`break in ${otherScript}:2`),
|
|
'found breakpoint in file that was not loaded yet');
|
|
})
|
|
.then(() => cli.quit())
|
|
.then(null, onFatal);
|
|
}
|