@@ -119,11 +119,44 @@ function createRunner(vitest: Vitest) {
119119 )
120120 }
121121
122- const processError = ! hasFailed ( files ) && ! sourceErrors . length && checker . getExitCode ( )
123- if ( processError ) {
124- const error = new Error ( checker . getOutput ( ) )
125- error . stack = ''
126- vitest . state . catchError ( error , 'Typecheck Error' )
122+ // The typechecker child process (tsc/vue-tsc) can terminate without producing
123+ // a complete set of diagnostics: a non-zero exit code, or being killed by a
124+ // signal (e.g. SIGABRT from an out-of-memory abort, which surfaces as exit
125+ // 134). We must not report the run as passing in that case, otherwise real
126+ // type errors slip through as a false green.
127+ if ( ! hasFailed ( files ) && ! sourceErrors . length ) {
128+ const exitCode = checker . getExitCode ( )
129+ const signal = checker . getSignal ( )
130+
131+ if ( exitCode || signal ) {
132+ const output = checker . getOutput ( )
133+ const looksLikeOom = signal === 'SIGABRT'
134+ || / J a v a S c r i p t h e a p o u t o f m e m o r y | R e a c h e d h e a p l i m i t | A l l o c a t i o n f a i l e d / i. test ( output )
135+
136+ let message : string
137+ if ( signal || looksLikeOom ) {
138+ const reason = signal
139+ ? `was terminated by signal ${ signal } `
140+ : `exited with code ${ exitCode } `
141+ message = `The ${ checker . getChecker ( ) } process ${ reason } before type checking finished.`
142+ if ( looksLikeOom ) {
143+ message += ` This usually means it ran out of memory — try increasing the `
144+ + `limit with NODE_OPTIONS=--max-old-space-size.`
145+ }
146+ if ( output ) {
147+ message += `\n\n${ output } `
148+ }
149+ }
150+ else {
151+ // a plain non-zero exit with diagnostics we couldn't attribute to a
152+ // file (e.g. a tsconfig error) — surface the checker output as-is
153+ message = output
154+ }
155+
156+ const error = new Error ( message )
157+ error . stack = ''
158+ vitest . state . catchError ( error , 'Typecheck Error' )
159+ }
127160 }
128161
129162 promisesMap . get ( project ) ?. resolve ( )
0 commit comments