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