()
| 7 | const assert = require('assert'); |
| 8 | |
| 9 | async function runTest() { |
| 10 | const script = 'require(\'inspector\').console.log(\'hello world\');'; |
| 11 | const child = new NodeInstance('--inspect-brk=0', script, ''); |
| 12 | |
| 13 | let out = ''; |
| 14 | child.on('stdout', (line) => out += line); |
| 15 | |
| 16 | const session = await child.connectInspectorSession(); |
| 17 | |
| 18 | const commands = [ |
| 19 | { 'method': 'Runtime.enable' }, |
| 20 | { 'method': 'Runtime.runIfWaitingForDebugger' }, |
| 21 | ]; |
| 22 | |
| 23 | await session.send({ method: 'NodeRuntime.enable' }); |
| 24 | await session.waitForNotification('NodeRuntime.waitingForDebugger'); |
| 25 | await session.send(commands); |
| 26 | await session.send({ method: 'NodeRuntime.disable' }); |
| 27 | |
| 28 | const msg = await session.waitForNotification('Runtime.consoleAPICalled'); |
| 29 | |
| 30 | assert.strictEqual(msg.params.type, 'log'); |
| 31 | assert.deepStrictEqual(msg.params.args, [{ |
| 32 | type: 'string', |
| 33 | value: 'hello world' |
| 34 | }]); |
| 35 | assert.strictEqual(out, ''); |
| 36 | |
| 37 | session.disconnect(); |
| 38 | } |
| 39 | |
| 40 | runTest().then(common.mustCall()); |
no test coverage detected
searching dependent graphs…