Skip to content

Commit 04d3c59

Browse files
committed
fix: fail if spawn(node) errors out
1 parent 5889837 commit 04d3c59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/api/child_process.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ export async function createVitestProcess(pkg: VitestPackage) {
7777
reject(new Error(`Vitest process exited with code ${code}`))
7878
}
7979

80+
function onError(error: Error) {
81+
reject(error)
82+
}
83+
8084
vitest.on('exit', onExit)
85+
vitest.on('error', onError)
8186

8287
waitForWsResolvedMeta(wss, pkg, false, 'child_process', vitest)
8388
.then((resolved) => {
@@ -93,6 +98,7 @@ export async function createVitestProcess(pkg: VitestPackage) {
9398
}, reject)
9499
.finally(() => {
95100
vitest.off('exit', onExit)
101+
vitest.off('exit', onError)
96102
})
97103
})
98104
}

0 commit comments

Comments
 (0)