• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
11const cli = startCLI(['--port=0', fixtures.path('debugger/three-lines.js')]);
12
13(async () => {
14  await cli.waitForInitialBreak();
15  await cli.waitForPrompt();
16  await cli.command('list(0)');
17  assert.match(cli.output, /> 1 let x = 1;/);
18  await cli.command('list(1)');
19  assert.match(cli.output, /> 1 let x = 1;\r?\n {2}2 x = x \+ 1;/);
20  await cli.command('list(10)');
21  assert.match(cli.output, /> 1 let x = 1;\r?\n {2}2 x = x \+ 1;\r?\n {2}3 module\.exports = x;\r?\n {2}4 /);
22  await cli.command('c');
23  await cli.waitFor(/disconnect/);
24  await cli.waitFor(/debug> $/);
25  await cli.command('list()');
26  await cli.waitFor(/ERR_DEBUGGER_ERROR/);
27  assert.match(cli.output, /Uncaught Error \[ERR_DEBUGGER_ERROR\]: Requires execution to be paused/);
28})()
29.finally(() => cli.quit())
30.then(common.mustCall());
31