• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const Path = require('path');
3
4const { test } = require('tap');
5
6const startCLI = require('./start-cli');
7
8test('display and navigate backtrace', (t) => {
9  const script = Path.join('examples', 'backtrace.js');
10  const cli = startCLI([script]);
11
12  function onFatal(error) {
13    cli.quit();
14    throw error;
15  }
16
17  return cli.waitForInitialBreak()
18    .then(() => cli.waitForPrompt())
19    .then(() => cli.stepCommand('c'))
20    .then(() => cli.command('bt'))
21    .then(() => {
22      t.match(cli.output, `#0 topFn ${script}:7:2`);
23    })
24    .then(() => cli.command('backtrace'))
25    .then(() => {
26      t.match(cli.output, `#0 topFn ${script}:7:2`);
27    })
28    .then(() => cli.quit())
29    .then(null, onFatal);
30});
31