Hey there!
I'm running into an issue when using this library in a codebase that uses Vitest for testing while using pool: 'forks'. In turn, I'm using forks to avoid issues with Prisma (vitest-dev/vitest#3106)
If the Sidequest engine is [transitively] imported into a test, the process.send call (specifically, process.send("ready")) causes Vitest to throw an error.
I think there are at least a couple ways around this
- Use a sentinel environment variable that causes the worker task to only send events when this is set. However, this would probably expose that environment variable to sub-tasks, which is an API surface decision to be made.
- Separate the worker initialization so it's not called by default (e.g. when writing
import { Sidequest } from "sidequest")
For the immediate future I'm going to mock sidequest in my test environment since the tests aren't targeted at Sidequest machinery.
A minimal reproduction of the issue is available here, showcasing both a raw process.send(...) and using sidequest itself.
Thanks!
Hey there!
I'm running into an issue when using this library in a codebase that uses Vitest for testing while using
pool: 'forks'. In turn, I'm usingforksto avoid issues with Prisma (vitest-dev/vitest#3106)If the Sidequest engine is [transitively] imported into a test, the
process.sendcall (specifically,process.send("ready")) causes Vitest to throw an error.I think there are at least a couple ways around this
import { Sidequest } from "sidequest")For the immediate future I'm going to mock sidequest in my test environment since the tests aren't targeted at Sidequest machinery.
A minimal reproduction of the issue is available here, showcasing both a raw
process.send(...)and using sidequest itself.Thanks!