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

Function test

test/parallel/test-inspector-worker-target.js:35–69  ·  view source on GitHub ↗
(isSetAutoAttachBeforeExecution)

Source from the content-addressed store, hash-verified

33}
34
35async function test(isSetAutoAttachBeforeExecution) {
36 const child = new NodeInstance(['--inspect-brk=0', '--experimental-worker-inspection'],
37 '',
38 fixtures.path('inspect-worker/index.js')
39 );
40
41
42 const session = await child.connectInspectorSession();
43 await setupInspector(session);
44
45 if (isSetAutoAttachBeforeExecution) {
46 await session.send({ method: 'Target.setAutoAttach', params: { autoAttach: true, waitForDebuggerOnStart: true } });
47 }
48 await session.waitForNotification('Debugger.paused');
49 await session.send({ method: 'Debugger.resume' });
50
51 const sessionId = '1';
52 const targetCreated = await session.waitForNotification('Target.targetCreated');
53 const targetId = targetCreated.params.targetInfo.targetId;
54
55 await assertTargetAttachedState(session, targetId, isSetAutoAttachBeforeExecution);
56
57 if (!isSetAutoAttachBeforeExecution) {
58 await session.send({ method: 'Target.setAutoAttach', params: { autoAttach: true, waitForDebuggerOnStart: true } });
59 }
60 await session.waitForNotification((notification) => {
61 return notification.method === 'Target.attachedToTarget' &&
62 notification.params.sessionId === sessionId;
63 });
64 await assertTargetAttachedState(session, targetId, true);
65 await setupInspector(session, sessionId);
66 await session.waitForNotification('Debugger.paused');
67 await session.send({ method: 'Debugger.resume', sessionId });
68 await session.waitForDisconnect();
69}
70
71test(true).then(common.mustCall());
72test(false).then(common.mustCall());

Callers 1

Calls 7

waitForNotificationMethod · 0.80
waitForDisconnectMethod · 0.80
setupInspectorFunction · 0.70
sendMethod · 0.65
pathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…