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// Stepping through breakpoints. 12{ 13 const cli = startCLI([fixtures.path('debugger/break.js')]); 14 15 function onFatal(error) { 16 cli.quit(); 17 throw error; 18 } 19 20 return cli.waitForInitialBreak() 21 .then(() => cli.waitForPrompt()) 22 .then(() => cli.command('watch("x")')) 23 .then(() => cli.command('watch("\\"Hello\\"")')) 24 .then(() => cli.command('watch("42")')) 25 .then(() => cli.command('watch("NaN")')) 26 .then(() => cli.command('watch("true")')) 27 .then(() => cli.command('watch("[1, 2]")')) 28 .then(() => cli.command('watch("process.env")')) 29 .then(() => cli.command('watchers')) 30 .then(() => { 31 assert.match(cli.output, /x is not defined/); 32 }) 33 .then(() => cli.command('unwatch("42")')) 34 .then(() => cli.stepCommand('n')) 35 .then(() => { 36 assert.match(cli.output, /0: x = 10/); 37 assert.match(cli.output, /1: "Hello" = 'Hello'/); 38 assert.match(cli.output, /2: NaN = NaN/); 39 assert.match(cli.output, /3: true = true/); 40 assert.match(cli.output, /4: \[1, 2\] = \[ 1, 2 \]/); 41 assert.match( 42 cli.output, 43 /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, 44 'shows "..." for process.env'); 45 }) 46 .then(() => cli.quit()) 47 .then(null, onFatal); 48} 49