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{ 12 const script = fixtures.path('debugger', 'three-lines.js'); 13 const cli = startCLI([script]); 14 15 cli.waitForInitialBreak() 16 .then(() => cli.waitForPrompt()) 17 .then(() => { 18 assert.match(cli.output, /debug>/, 'prints a prompt'); 19 assert.match( 20 cli.output, 21 /< Debugger listening on [^\n]*9229/, 22 'forwards child output'); 23 }) 24 .then(() => cli.command('["hello", "world"].join(" ")')) 25 .then(() => { 26 assert.match(cli.output, /hello world/, 'prints the result'); 27 }) 28 .then(() => cli.command('')) 29 .then(() => { 30 assert.match( 31 cli.output, 32 /hello world/, 33 'repeats the last command on <enter>' 34 ); 35 }) 36 .then(() => cli.command('version')) 37 .then(() => { 38 assert.ok( 39 cli.output.includes(process.versions.v8), 40 'version prints the v8 version' 41 ); 42 }) 43 .then(() => cli.quit()) 44 .then((code) => { 45 assert.strictEqual(code, 0); 46 }); 47} 48