2017-07-24 18:23:04 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const assert = require('assert');
|
2017-10-14 04:42:38 +02:00
|
|
|
const { NodeInstance } = require('../common/inspector-helper.js');
|
2017-07-24 18:23:04 +02:00
|
|
|
|
|
|
|
async function runTests() {
|
2017-10-04 07:18:00 +02:00
|
|
|
const child = new NodeInstance(['--inspect-brk=0'],
|
2017-07-24 18:23:04 +02:00
|
|
|
`let c = 0;
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
console.log(new Object());
|
|
|
|
if (c++ === 10)
|
|
|
|
clearInterval(interval);
|
|
|
|
}, 10);`);
|
|
|
|
const session = await child.connectInspectorSession();
|
|
|
|
|
|
|
|
session.send([
|
|
|
|
{ 'method': 'Profiler.setSamplingInterval', 'params': { 'interval': 100 } },
|
|
|
|
{ 'method': 'Profiler.enable' },
|
|
|
|
{ 'method': 'Runtime.runIfWaitingForDebugger' },
|
|
|
|
{ 'method': 'Profiler.start' }]);
|
|
|
|
while (await child.nextStderrString() !==
|
|
|
|
'Waiting for the debugger to disconnect...');
|
|
|
|
await session.send({ 'method': 'Profiler.stop' });
|
|
|
|
session.disconnect();
|
|
|
|
assert.strictEqual(0, (await child.expectShutdown()).exitCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
common.crashOnUnhandledRejection();
|
|
|
|
runTests();
|