• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3common.skipIfInspectorDisabled();
4common.skipIf32Bits();
5const { NodeInstance } = require('../common/inspector-helper.js');
6const assert = require('assert');
7
8const script = `
9setTimeout(() => {
10  debugger;
11  process.exitCode = 55;
12}, 50);
13`;
14
15async function skipBreakpointAtStart(session) {
16  await session.waitForBreakOnLine(1, '[eval]');
17  await session.send({ 'method': 'Debugger.resume' });
18}
19
20async function checkAsyncStackTrace(session) {
21  console.error('[test]', 'Verify basic properties of asyncStackTrace');
22  const paused = await session.waitForBreakOnLine(2, '[eval]');
23  assert(paused.params.asyncStackTrace,
24         `${Object.keys(paused.params)} contains "asyncStackTrace" property`);
25  assert(paused.params.asyncStackTrace.description, 'Timeout');
26  assert(paused.params.asyncStackTrace.callFrames
27           .some((frame) => frame.url === 'internal/process/execution.js'));
28}
29
30async function runTests() {
31  const instance = new NodeInstance(undefined, script);
32  const session = await instance.connectInspectorSession();
33  await session.send([
34    { 'method': 'Runtime.enable' },
35    { 'method': 'Debugger.enable' },
36    { 'method': 'Debugger.setAsyncCallStackDepth',
37      'params': { 'maxDepth': 10 } },
38    { 'method': 'Debugger.setBlackboxPatterns',
39      'params': { 'patterns': [] } },
40    { 'method': 'Runtime.runIfWaitingForDebugger' },
41  ]);
42  await skipBreakpointAtStart(session);
43  await checkAsyncStackTrace(session);
44
45  await session.runToCompletion();
46  assert.strictEqual((await instance.expectShutdown()).exitCode, 55);
47}
48
49runTests().then(common.mustCall());
50