1'use strict'; 2const common = require('../common'); 3 4common.skipIfInspectorDisabled(); 5 6const fixtures = require('../common/fixtures'); 7const startCLI = require('../common/debugger'); 8 9const assert = require('assert'); 10 11// List scripts. 12{ 13 const script = fixtures.path('debugger', 'three-lines.js'); 14 const cli = startCLI([script]); 15 16 function onFatal(error) { 17 cli.quit(); 18 throw error; 19 } 20 21 return cli.waitForInitialBreak() 22 .then(() => cli.waitForPrompt()) 23 .then(() => cli.command('scripts')) 24 .then(() => { 25 assert.match( 26 cli.output, 27 /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m, 28 'lists the user script'); 29 assert.doesNotMatch( 30 cli.output, 31 /\d+: node:internal\/buffer/, 32 'omits node-internal scripts'); 33 }) 34 .then(() => cli.command('scripts(true)')) 35 .then(() => { 36 assert.match( 37 cli.output, 38 /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/, 39 'lists the user script'); 40 assert.match( 41 cli.output, 42 /\d+: internal\/buffer/, 43 'includes node-internal scripts'); 44 }) 45 .then(() => cli.quit()) 46 .then(null, onFatal); 47} 48