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

Function test

test/parallel/test-worker-messaging-errors-handler.js:12–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10const assert = require('node:assert');
11
12async function test() {
13 const worker = new Worker(__filename, { workerData: { children: true } });
14
15 await assert.rejects(common.mustCall(function() {
16 return postMessageToThread(worker.threadId);
17 }), {
18 name: 'Error',
19 code: 'ERR_WORKER_MESSAGING_ERRORED',
20 });
21
22 worker.postMessage('success');
23}
24
25if (!workerData?.children) {
26 test();

Calls 2

postMessageMethod · 0.95
postMessageToThreadFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…