2016-12-11 14:36:58 -08:00
|
|
|
'use strict';
|
2021-04-08 23:55:45 -07:00
|
|
|
const common = require('../common');
|
2016-12-11 14:36:58 -08:00
|
|
|
|
2021-04-08 23:55:45 -07:00
|
|
|
common.skipIfInspectorDisabled();
|
2016-12-11 14:36:58 -08:00
|
|
|
|
2021-04-08 23:55:45 -07:00
|
|
|
const fixtures = require('../common/fixtures');
|
2021-05-03 21:58:42 -07:00
|
|
|
const startCLI = require('../common/debugger');
|
2016-12-11 14:36:58 -08:00
|
|
|
|
2021-04-08 23:55:45 -07:00
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
// List scripts.
|
|
|
|
{
|
2021-06-25 22:11:59 -07:00
|
|
|
const script = fixtures.path('debugger', 'three-lines.js');
|
2023-03-28 00:03:40 +02:00
|
|
|
const cli = startCLI(['--port=0', script]);
|
2016-12-11 14:36:58 -08:00
|
|
|
|
2022-09-29 16:32:34 -05:00
|
|
|
(async () => {
|
|
|
|
try {
|
|
|
|
await cli.waitForInitialBreak();
|
|
|
|
await cli.waitForPrompt();
|
|
|
|
await cli.command('scripts');
|
2021-04-08 23:55:45 -07:00
|
|
|
assert.match(
|
2016-12-11 14:36:58 -08:00
|
|
|
cli.output,
|
2021-06-25 22:11:59 -07:00
|
|
|
/^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
|
2016-12-11 14:36:58 -08:00
|
|
|
'lists the user script');
|
2021-04-08 23:55:45 -07:00
|
|
|
assert.doesNotMatch(
|
2016-12-11 14:36:58 -08:00
|
|
|
cli.output,
|
2021-04-08 23:55:45 -07:00
|
|
|
/\d+: node:internal\/buffer/,
|
2016-12-11 14:36:58 -08:00
|
|
|
'omits node-internal scripts');
|
2022-09-29 16:32:34 -05:00
|
|
|
await cli.command('scripts(true)');
|
2021-04-08 23:55:45 -07:00
|
|
|
assert.match(
|
2016-12-11 14:36:58 -08:00
|
|
|
cli.output,
|
2021-06-25 22:11:59 -07:00
|
|
|
/\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
|
2016-12-11 14:36:58 -08:00
|
|
|
'lists the user script');
|
2021-04-08 23:55:45 -07:00
|
|
|
assert.match(
|
2016-12-11 14:36:58 -08:00
|
|
|
cli.output,
|
2021-04-08 23:55:45 -07:00
|
|
|
/\d+: node:internal\/buffer/,
|
2016-12-11 14:36:58 -08:00
|
|
|
'includes node-internal scripts');
|
2022-09-29 16:32:34 -05:00
|
|
|
} finally {
|
|
|
|
await cli.quit();
|
|
|
|
}
|
|
|
|
})().then(common.mustCall());
|
2021-04-08 23:55:45 -07:00
|
|
|
}
|