11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled();
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
71cb0ef41Sopenharmony_ciconst startCLI = require('../common/debugger');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst assert = require('assert');
101cb0ef41Sopenharmony_ciconst path = require('path');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci// Display and navigate backtrace.
131cb0ef41Sopenharmony_ci{
141cb0ef41Sopenharmony_ci  const scriptFullPath = fixtures.path('debugger', 'backtrace.js');
151cb0ef41Sopenharmony_ci  const script = path.relative(process.cwd(), scriptFullPath);
161cb0ef41Sopenharmony_ci  const cli = startCLI(['--port=0', script]);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci  async function runTest() {
191cb0ef41Sopenharmony_ci    try {
201cb0ef41Sopenharmony_ci      await cli.waitForInitialBreak();
211cb0ef41Sopenharmony_ci      await cli.waitForPrompt();
221cb0ef41Sopenharmony_ci      await cli.stepCommand('c');
231cb0ef41Sopenharmony_ci      await cli.command('bt');
241cb0ef41Sopenharmony_ci      assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`));
251cb0ef41Sopenharmony_ci      await cli.command('backtrace');
261cb0ef41Sopenharmony_ci      assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`));
271cb0ef41Sopenharmony_ci    } finally {
281cb0ef41Sopenharmony_ci      await cli.quit();
291cb0ef41Sopenharmony_ci    }
301cb0ef41Sopenharmony_ci  }
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci  runTest();
331cb0ef41Sopenharmony_ci}
34