mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
6a7d3ca515
Highlights: * The `node-inspect` test suite passes against latest master. * Removes use of deprecated `repl.rli`. Compare: https://github.com/nodejs/node-inspect/compare/v1.11.5...v1.11.6 PR-URL: https://github.com/nodejs/node/pull/28039 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
35 lines
858 B
JavaScript
35 lines
858 B
JavaScript
'use strict';
|
|
const { test } = require('tap');
|
|
|
|
const startCLI = require('./start-cli');
|
|
|
|
test('Debugger agent direct access', (t) => {
|
|
const cli = startCLI(['examples/three-lines.js']);
|
|
const scriptPattern = /^\* (\d+): examples(?:\/|\\)three-lines.js/;
|
|
|
|
function onFatal(error) {
|
|
cli.quit();
|
|
throw error;
|
|
}
|
|
|
|
return cli.waitForInitialBreak()
|
|
.then(() => cli.waitForPrompt())
|
|
.then(() => cli.command('scripts'))
|
|
.then(() => {
|
|
const [, scriptId] = cli.output.match(scriptPattern);
|
|
return cli.command(
|
|
`Debugger.getScriptSource({ scriptId: '${scriptId}' })`
|
|
);
|
|
})
|
|
.then(() => {
|
|
t.match(
|
|
cli.output,
|
|
/scriptSource:[ \n]*'(?:\(function \(|let x = 1)/);
|
|
t.match(
|
|
cli.output,
|
|
/let x = 1;/);
|
|
})
|
|
.then(() => cli.quit())
|
|
.then(null, onFatal);
|
|
});
|