MCPcopy Index your code
hub / github.com/nodejs/node / runTest

Function runTest

test/parallel/test-inspector-console.js:9–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7const assert = require('assert');
8
9async 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
40runTest().then(common.mustCall());

Callers 1

Calls 5

waitForNotificationMethod · 0.80
sendMethod · 0.65
disconnectMethod · 0.65
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…