fix(picker): keep the worker-boundary mock off the vitest IPC channel
The mocked process.send consumed vitest's own fork-pool IPC messages and immediately ran the post callback, whose disconnect() severed the test worker's channel (process.connected is true under forks) — the whole spec's results vanished and win32-dialog-bindings.ts/win32-dialog-worker.ts fell to near-zero coverage on CI. The mock now records without invoking the callback or disconnecting; the real close lifecycle stays with built-worker.e2e.ts. Verified under both the threads and forks pools.
This commit is contained in:
@@ -271,9 +271,13 @@ describe('the worker entry over a mocked process boundary', () => {
|
||||
const installBoundary = (): { posted: { kind: string; message?: string }[] } => {
|
||||
const posted: { kind: string; message?: string }[] = []
|
||||
process.env.DSH_DIALOG_TITLE = 'Pick'
|
||||
;(process as { send?: unknown }).send = (message: { kind: string }, callback?: () => void) => {
|
||||
// Never invoke the post callback: it runs the worker's disconnect(), and
|
||||
// this process is IPC-connected under the forks pool — severing vitest's
|
||||
// own channel would kill the test worker. The real close lifecycle
|
||||
// belongs to built-worker.e2e.ts.
|
||||
;(process as { send?: unknown }).send = (message: { kind: string }) => {
|
||||
posted.push(message)
|
||||
callback?.()
|
||||
return true
|
||||
}
|
||||
return { posted }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user