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');
|
2016-12-11 14:36:58 -08:00
|
|
|
const cli = startCLI([script]);
|
|
|
|
|
|
|
|
function onFatal(error) {
|
|
|
|
cli.quit();
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
|
2017-04-04 09:47:43 -07:00
|
|
|
return cli.waitForInitialBreak()
|
2016-12-11 14:36:58 -08:00
|
|
|
.then(() => cli.waitForPrompt())
|
|
|
|
.then(() => cli.command('scripts'))
|
|
|
|
.then(() => {
|
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');
|
|
|
|
})
|
|
|
|
.then(() => cli.command('scripts(true)'))
|
|
|
|
.then(() => {
|
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');
|
|
|
|
})
|
|
|
|
.then(() => cli.quit())
|
|
|
|
.then(null, onFatal);
|
2021-04-08 23:55:45 -07:00
|
|
|
}
|