mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
f1f0eb2595
Pause child on startup using inspect-brk=0 until the parent debugger is ready. PR-URL: https://github.com/nodejs/node/pull/15774 Fixes: https://github.com/nodejs/node/issues/14897 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
const assert = require('assert');
|
|
const { NodeInstance } = require('../common/inspector-helper.js');
|
|
|
|
async function runTests() {
|
|
const child = new NodeInstance(['--inspect-brk=0'],
|
|
`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();
|