Skip to content

--typecheck reports "no type errors" (exit 0) when the tsc child process runs out of memory #10697

Closed

Description

@turenar

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"   ✅ correct

Expected 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.9

Used Package Manager

pnpm

Validations

Activity

  1. added theissue type on Jul 2, 2026
  2. added
    p3-minor-bug
    feat: typecheck
    and removed
    p3-minor-bug
    on Jul 3, 2026
  3. locked and limited conversation to collaborators on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: typecheckp3-minor-bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions