| 10 | const { NodeInstance } = require('../common/inspector-helper.js'); |
| 11 | |
| 12 | async function setupInspector(session, sessionId = undefined) { |
| 13 | await session.send({ method: 'NodeRuntime.enable', sessionId }); |
| 14 | await session.waitForNotification('NodeRuntime.waitingForDebugger'); |
| 15 | await session.send({ method: 'Runtime.enable', sessionId }); |
| 16 | await session.send({ method: 'Debugger.enable', sessionId }); |
| 17 | await session.send({ method: 'Runtime.runIfWaitingForDebugger', sessionId }); |
| 18 | await session.send({ method: 'NodeRuntime.disable', sessionId }); |
| 19 | await session.waitForNotification((notification) => { |
| 20 | return notification.method === 'Debugger.scriptParsed' && |
| 21 | notification.params.url === 'node:internal/bootstrap/realm' && |
| 22 | notification.sessionId === sessionId; |
| 23 | }); |
| 24 | } |
| 25 | |
| 26 | async function assertTargetAttachedState(session, targetId, attached) { |
| 27 | const { targetInfos } = await session.send({ method: 'Target.getTargets' }); |