(isSetAutoAttachBeforeExecution)
| 33 | } |
| 34 | |
| 35 | async function test(isSetAutoAttachBeforeExecution) { |
| 36 | const child = new NodeInstance(['--inspect-brk=0', '--experimental-worker-inspection'], |
| 37 | '', |
| 38 | fixtures.path('inspect-worker/index.js') |
| 39 | ); |
| 40 | |
| 41 | |
| 42 | const session = await child.connectInspectorSession(); |
| 43 | await setupInspector(session); |
| 44 | |
| 45 | if (isSetAutoAttachBeforeExecution) { |
| 46 | await session.send({ method: 'Target.setAutoAttach', params: { autoAttach: true, waitForDebuggerOnStart: true } }); |
| 47 | } |
| 48 | await session.waitForNotification('Debugger.paused'); |
| 49 | await session.send({ method: 'Debugger.resume' }); |
| 50 | |
| 51 | const sessionId = '1'; |
| 52 | const targetCreated = await session.waitForNotification('Target.targetCreated'); |
| 53 | const targetId = targetCreated.params.targetInfo.targetId; |
| 54 | |
| 55 | await assertTargetAttachedState(session, targetId, isSetAutoAttachBeforeExecution); |
| 56 | |
| 57 | if (!isSetAutoAttachBeforeExecution) { |
| 58 | await session.send({ method: 'Target.setAutoAttach', params: { autoAttach: true, waitForDebuggerOnStart: true } }); |
| 59 | } |
| 60 | await session.waitForNotification((notification) => { |
| 61 | return notification.method === 'Target.attachedToTarget' && |
| 62 | notification.params.sessionId === sessionId; |
| 63 | }); |
| 64 | await assertTargetAttachedState(session, targetId, true); |
| 65 | await setupInspector(session, sessionId); |
| 66 | await session.waitForNotification('Debugger.paused'); |
| 67 | await session.send({ method: 'Debugger.resume', sessionId }); |
| 68 | await session.waitForDisconnect(); |
| 69 | } |
| 70 | |
| 71 | test(true).then(common.mustCall()); |
| 72 | test(false).then(common.mustCall()); |
no test coverage detected
searching dependent graphs…