()
| 43 | } |
| 44 | |
| 45 | async function runTests() { |
| 46 | const instance = new NodeInstance(['--inspect-brk=0', '--expose-internals'], |
| 47 | script); |
| 48 | const session = await instance.connectInspectorSession(); |
| 49 | |
| 50 | await session.send({ method: 'NodeRuntime.enable' }); |
| 51 | await session.waitForNotification('NodeRuntime.waitingForDebugger'); |
| 52 | await session.send({ 'method': 'Debugger.enable' }); |
| 53 | await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); |
| 54 | await session.send({ method: 'NodeRuntime.disable' }); |
| 55 | |
| 56 | await session.waitForBreakOnLine(2, '[eval]'); |
| 57 | |
| 58 | await session.send({ 'method': 'Runtime.enable' }); |
| 59 | await getContext(session); |
| 60 | await session.send({ 'method': 'Debugger.resume' }); |
| 61 | const childContext = await getContext(session); |
| 62 | await session.waitForBreakOnLine(11, '[eval]'); |
| 63 | |
| 64 | console.error('[test]', 'Script is unbound'); |
| 65 | await session.send({ 'method': 'Debugger.resume' }); |
| 66 | await session.waitForBreakOnLine(15, '[eval]'); |
| 67 | |
| 68 | console.error('[test]', 'vm.runInContext associates script with context'); |
| 69 | await session.send({ 'method': 'Debugger.resume' }); |
| 70 | await checkScriptContext(session, childContext); |
| 71 | await session.waitForBreakOnLine(18, '[eval]'); |
| 72 | |
| 73 | console.error('[test]', 'vm.runInNewContext associates script with context'); |
| 74 | await session.send({ 'method': 'Debugger.resume' }); |
| 75 | const thirdContext = await getContext(session); |
| 76 | await checkScriptContext(session, thirdContext); |
| 77 | await session.waitForBreakOnLine(21, '[eval]'); |
| 78 | |
| 79 | console.error('[test]', 'vm.runInNewContext can contain debugger statements'); |
| 80 | await session.send({ 'method': 'Debugger.resume' }); |
| 81 | const fourthContext = await getContext(session); |
| 82 | await checkScriptContext(session, fourthContext); |
| 83 | await session.waitForBreakOnLine(0, 'evalmachine.<anonymous>'); |
| 84 | |
| 85 | await session.runToCompletion(); |
| 86 | assert.strictEqual((await instance.expectShutdown()).exitCode, 0); |
| 87 | } |
| 88 | |
| 89 | runTests().then(common.mustCall()); |
no test coverage detected
searching dependent graphs…