11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled(); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ciconst { NodeInstance } = require('../common/inspector-helper.js'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciasync function testBreakpointOnStart(session) { 101cb0ef41Sopenharmony_ci const commands = [ 111cb0ef41Sopenharmony_ci { 'method': 'Runtime.enable' }, 121cb0ef41Sopenharmony_ci { 'method': 'Debugger.enable' }, 131cb0ef41Sopenharmony_ci { 'method': 'Debugger.setPauseOnExceptions', 141cb0ef41Sopenharmony_ci 'params': { 'state': 'none' } }, 151cb0ef41Sopenharmony_ci { 'method': 'Debugger.setAsyncCallStackDepth', 161cb0ef41Sopenharmony_ci 'params': { 'maxDepth': 0 } }, 171cb0ef41Sopenharmony_ci { 'method': 'Profiler.enable' }, 181cb0ef41Sopenharmony_ci { 'method': 'Profiler.setSamplingInterval', 191cb0ef41Sopenharmony_ci 'params': { 'interval': 100 } }, 201cb0ef41Sopenharmony_ci { 'method': 'Debugger.setBlackboxPatterns', 211cb0ef41Sopenharmony_ci 'params': { 'patterns': [] } }, 221cb0ef41Sopenharmony_ci { 'method': 'Runtime.runIfWaitingForDebugger' }, 231cb0ef41Sopenharmony_ci ]; 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci session.send(commands); 261cb0ef41Sopenharmony_ci await session.waitForBreakOnLine(0, session.scriptURL()); 271cb0ef41Sopenharmony_ci} 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ciasync function runTests() { 301cb0ef41Sopenharmony_ci const child = new NodeInstance(['--inspect-brk=0']); 311cb0ef41Sopenharmony_ci const session = await child.connectInspectorSession(); 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ci await testBreakpointOnStart(session); 341cb0ef41Sopenharmony_ci await session.runToCompletion(); 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci assert.strictEqual((await child.expectShutdown()).exitCode, 55); 371cb0ef41Sopenharmony_ci} 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_cirunTests().then(common.mustCall()); 40