• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3common.skipIfInspectorDisabled();
4const assert = require('assert');
5const { NodeInstance } = require('../common/inspector-helper.js');
6
7async function runTests() {
8  const child = new NodeInstance(['--inspect-brk=0'],
9                                 `let c = 0;
10                                  const interval = setInterval(() => {
11                                   console.log(new Object());
12                                   if (c++ === 10)
13                                     clearInterval(interval);
14                                 }, ${common.platformTimeout(30)});`);
15  const session = await child.connectInspectorSession();
16
17  session.send([
18    { method: 'Profiler.setSamplingInterval',
19      params: { interval: common.platformTimeout(300) } },
20    { method: 'Profiler.enable' },
21    { method: 'Runtime.runIfWaitingForDebugger' },
22    { method: 'Profiler.start' }]);
23  while (await child.nextStderrString() !==
24         'Waiting for the debugger to disconnect...');
25  await session.send({ method: 'Profiler.stop' });
26  session.disconnect();
27  assert.strictEqual((await child.expectShutdown()).exitCode, 0);
28}
29
30runTests().then(common.mustCall());
31