1'use strict'; 2const common = require('../common'); 3 4common.skipIfInspectorDisabled(); 5 6const assert = require('assert'); 7const { NodeInstance } = require('../common/inspector-helper.js'); 8 9async function testBreakpointOnStart(session) { 10 const commands = [ 11 { 'method': 'Runtime.enable' }, 12 { 'method': 'Debugger.enable' }, 13 { 'method': 'Debugger.setPauseOnExceptions', 14 'params': { 'state': 'none' } }, 15 { 'method': 'Debugger.setAsyncCallStackDepth', 16 'params': { 'maxDepth': 0 } }, 17 { 'method': 'Profiler.enable' }, 18 { 'method': 'Profiler.setSamplingInterval', 19 'params': { 'interval': 100 } }, 20 { 'method': 'Debugger.setBlackboxPatterns', 21 'params': { 'patterns': [] } }, 22 { 'method': 'Runtime.runIfWaitingForDebugger' }, 23 ]; 24 25 session.send(commands); 26 await session.waitForBreakOnLine(0, session.scriptURL()); 27} 28 29async function runTests() { 30 const child = new NodeInstance(['--inspect', '--inspect-brk']); 31 const session = await child.connectInspectorSession(); 32 33 await testBreakpointOnStart(session); 34 await session.runToCompletion(); 35 36 assert.strictEqual((await child.expectShutdown()).exitCode, 55); 37} 38 39runTests().then(common.mustCall()); 40