MCPcopy Create free account
hub / github.com/nodejs/node / runTest

Function runTest

test/parallel/test-inspector-waiting-for-disconnect.js:14–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12}
13
14async 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
47runTest().then(common.mustCall());

Calls 8

expectShutdownMethod · 0.95
waitForNotificationMethod · 0.80
someMethod · 0.80
sendMethod · 0.65
disconnectMethod · 0.65
failMethod · 0.45

Tested by

no test coverage detected