josdejong / workerpool

Offload tasks to a pool of workers on node.js and in the browser
Apache License 2.0
2.04k stars 148 forks source link

Error when testing in react component #435

Closed theahmadjawad closed 4 months ago

theahmadjawad commented 5 months ago

I am having trouble testing a component that uses workerpool. I am getting the following error TypeError: 'postMessage' requires 2 arguments: 'message' and 'targetOrigin'

I am using vitest. This Is my vitest config

test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: ['@vitest/web-worker'],
  },

This is how I am using the workerpool inside the component

const pool = useMemo(() => workerpool.pool(Worker, {
    workerOpts: {
      type: 'module',
    },
    workerType: 'web',
  }), []);
josdejong commented 5 months ago

Thanks for reporting. How can we reproduce this issue?

josdejong commented 4 months ago

Closing due to lack of response. Please reopen if needed.