• 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');
10const { spawn } = require('child_process');
11
12const script = fixtures.path('debugger', 'alive.js');
13
14const runTest = async () => {
15  const target = spawn(process.execPath, [script]);
16  const cli = startCLI(['-p', `${target.pid}`]);
17
18  try {
19    await cli.waitForPrompt();
20    await cli.command('sb("alive.js", 3)');
21    await cli.waitFor(/break/);
22    await cli.waitForPrompt();
23    assert.match(
24      cli.output,
25      /> 3 {3}\+\+x;/,
26      'marks the 3rd line');
27  } catch (error) {
28    assert.ifError(error);
29  } finally {
30    await cli.quit();
31    target.kill();
32  }
33};
34
35runTest().then(common.mustCall());
36