-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
forks pool mode is not compatible with use of process.send in user code #8109
Copy link
Copy link
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Describe the bug
if you have some code that might be invoked in fork, and if it checks for process.send, this will be true when vitest is running in forks mode. vitest will assume every message from process.send can be deserialised with Buffer.from, which can lead to errors.
I am currently working around by checking process.title but this may be fragile - perhaps there could be (or is?) an official way to check whether we are in a child proces we have invoked, or whether vitest has invoked it...
you may also have another suggestion
originally reported in #7082.
Reproduction
https://stackblitz.com/edit/node-fvacfgbn
// in user code
import process from 'node:process'
if (process.send) {
// this will be received by vitest's birpc
process.send({
type: 'foo',
})
}
export const thing = 42System Info
stackblitzUsed Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)