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

Function runTests

test/parallel/test-inspector-scriptparsed-context.js:45–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45async 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
89runTests().then(common.mustCall());

Calls 9

expectShutdownMethod · 0.95
checkScriptContextFunction · 0.85
waitForNotificationMethod · 0.80
waitForBreakOnLineMethod · 0.80
runToCompletionMethod · 0.80
getContextFunction · 0.70
sendMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…