11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ci// Regression test for https://github.com/nodejs/node/issues/32648
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled();
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst { NodeInstance } = require('../common/inspector-helper.js');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciasync function runTest() {
111cb0ef41Sopenharmony_ci  const child = new NodeInstance(['--inspect-brk-node=0', '-p', '42']);
121cb0ef41Sopenharmony_ci  const session = await child.connectInspectorSession();
131cb0ef41Sopenharmony_ci  await session.send({ method: 'Runtime.enable' });
141cb0ef41Sopenharmony_ci  await session.send({ method: 'Debugger.enable' });
151cb0ef41Sopenharmony_ci  await session.send({ method: 'Runtime.runIfWaitingForDebugger' });
161cb0ef41Sopenharmony_ci  await session.waitForNotification((notification) => {
171cb0ef41Sopenharmony_ci    // The main assertion here is that we do hit the loader script first.
181cb0ef41Sopenharmony_ci    return notification.method === 'Debugger.scriptParsed' &&
191cb0ef41Sopenharmony_ci           notification.params.url === 'node:internal/bootstrap/realm';
201cb0ef41Sopenharmony_ci  });
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci  await session.waitForNotification('Debugger.paused');
231cb0ef41Sopenharmony_ci  await session.send({ method: 'Debugger.resume' });
241cb0ef41Sopenharmony_ci  await session.waitForNotification('Debugger.paused');
251cb0ef41Sopenharmony_ci  await session.runToCompletion();
261cb0ef41Sopenharmony_ci}
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_cirunTest().then(common.mustCall());
29