()
| 12 | } |
| 13 | |
| 14 | async function runTest() { |
| 15 | const child = new NodeInstance(['--inspect-brk=0', '-e', 'process.exit(55)']); |
| 16 | const session = await child.connectInspectorSession(); |
| 17 | const oldStyleSession = await child.connectInspectorSession(); |
| 18 | await oldStyleSession.send([ |
| 19 | { method: 'Runtime.enable' }]); |
| 20 | await session.send({ method: 'NodeRuntime.enable' }); |
| 21 | await session.waitForNotification('NodeRuntime.waitingForDebugger'); |
| 22 | await session.send([ |
| 23 | { method: 'Runtime.enable' }, |
| 24 | { method: 'NodeRuntime.notifyWhenWaitingForDisconnect', |
| 25 | params: { enabled: true } }, |
| 26 | { method: 'Runtime.runIfWaitingForDebugger' }]); |
| 27 | await session.send({ method: 'NodeRuntime.disable' }); |
| 28 | await session.waitForNotification((notification) => { |
| 29 | return notification.method === 'NodeRuntime.waitingForDisconnect'; |
| 30 | }); |
| 31 | const receivedExecutionContextDestroyed = |
| 32 | session.unprocessedNotifications().some(mainContextDestroyed); |
| 33 | if (receivedExecutionContextDestroyed) { |
| 34 | assert.fail('When NodeRuntime enabled, ' + |
| 35 | 'Runtime.executionContextDestroyed should not be sent'); |
| 36 | } |
| 37 | const { result: { value } } = await session.send({ |
| 38 | method: 'Runtime.evaluate', params: { expression: '42' } |
| 39 | }); |
| 40 | assert.strictEqual(value, 42); |
| 41 | await session.disconnect(); |
| 42 | await oldStyleSession.waitForNotification(mainContextDestroyed); |
| 43 | await oldStyleSession.disconnect(); |
| 44 | assert.strictEqual((await child.expectShutdown()).exitCode, 55); |
| 45 | } |
| 46 | |
| 47 | runTest().then(common.mustCall()); |
no test coverage detected