MCPcopy
hub / github.com/vitest-dev/vitest / testWorker

Function testWorker

test/core/test/web-worker-node.test.ts:152–161  ·  view source on GitHub ↗
(worker: Worker)

Source from the content-addressed store, hash-verified

150}
151
152function testWorker(worker: Worker) {
153 return new Promise<void>((resolve) => {
154 worker.postMessage('hello')
155 worker.onmessage = (e) => {
156 expect(e.data).toBe('hello world')
157
158 resolve()
159 }
160 })
161}
162
163function testSelfWorker(worker: Worker) {
164 return new Promise<boolean>((resolve) => {

Callers 1

Calls 2

resolveFunction · 0.70
postMessageMethod · 0.45

Tested by

no test coverage detected