• 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 path = require('path');
11
12// Display and navigate backtrace.
13{
14  const scriptFullPath = fixtures.path('debugger', 'backtrace.js');
15  const script = path.relative(process.cwd(), scriptFullPath);
16  const cli = startCLI([script]);
17
18  function onFatal(error) {
19    cli.quit();
20    throw error;
21  }
22
23  return cli.waitForInitialBreak()
24    .then(() => cli.waitForPrompt())
25    .then(() => cli.stepCommand('c'))
26    .then(() => cli.command('bt'))
27    .then(() => {
28      assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`));
29    })
30    .then(() => cli.command('backtrace'))
31    .then(() => {
32      assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`));
33    })
34    .then(() => cli.quit())
35    .then(null, onFatal);
36}
37