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

Function skipChildMain

test/parallel/test-inspector-connect-main-thread.js:172–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172async function skipChildMain() {
173 // Ensures the worker does not terminate too soon
174 parentPort.on('message', () => { });
175
176 const session = new Session();
177 session.connectToMainThread();
178 const notifications = [];
179 session.on('NodeWorker.attachedToWorker', (n) => notifications.push(n));
180 await post(session, 'NodeWorker.enable', { waitForDebuggerOnStart: false });
181 // 2 notifications mean there are 2 workers so we are connected to a main
182 // thread
183 assert.strictEqual(notifications.length, 2);
184 parentPort.postMessage('Ready');
185 parentPort.postMessage({ messagesSent });
186 parentPort.close();
187 console.log('Skip child is done');
188}
189
190if (isMainThread) {
191 main().then(common.mustCall());

Calls 7

connectToMainThreadMethod · 0.95
postFunction · 0.70
closeMethod · 0.65
onMethod · 0.45
pushMethod · 0.45
postMessageMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…