Repository navigation
Description
Describe the bug
When running vitest --typecheck, the type errors are collected by a tsc child process. If that child process runs out of heap (OOM), Vitest reports Type Errors no errors and exits 0 — even though real type errors exist and tsc never actually finished checking.
This turns a hard failure into a false green: type errors slip through CI undetected. The tsc child hard-aborts (FATAL ERROR: Reached heap limit ... JavaScript heap out of memory, exit 134), yet Vitest still reports "no errors".
tsc itself is behaving correctly: given enough heap it always reports the error; given too little it crashes with a non-zero exit code. The problem is that Vitest treats that abnormal/failed child exit as "no type errors" instead of surfacing it as a run failure.
Reproduction
https://github.com/turenar/vitest-typecheck-oom-repro
NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.json --noEmit
# -> src/error.test.ts(16,9): error TS2322: Type 'string' is not assignable to type 'number'.
NODE_OPTIONS=--max-old-space-size=512 tsc -p tsconfig.json --noEmit
# -> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
# -> Aborted (core dumped) (exit 134)
NODE_OPTIONS=--max-old-space-size=512 vitest --run --typecheck.only # exit 0, "no errors" ❌ FALSE GREEN
NODE_OPTIONS=--max-old-space-size=8192 vitest --run --typecheck.only # exit 1, "1 failed" ✅ correctExpected behavior
If the tsc/vue-tsc child process exits abnormally (non-zero for a reason other than "type errors found", killed by a signal, OOM abort, or produces no parseable diagnostics output), Vitest should fail the run with a clear error (e.g. "typecheck process exited abnormally / possible out of memory") rather than reporting no errors and exit 0.
System Info
System:
OS: Linux 6.6 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
CPU: (16) x64 AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
Memory: 10.81 GB / 17.56 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.22.3 - /usr/bin/node
npm: 10.9.8 - /usr/bin/npm
pnpm: 10.30.3 - /home/mimi/.local/share/pnpm/pnpm
npmPackages:
vitest: ^4.1.0 => 4.1.9Used 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.
Activity