From 0e960aa78b1362b4a472673761ea5e38a95563b5 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 19 May 2025 15:14:41 +0200 Subject: [PATCH] fix: throw an error if typechecker failed to spawn (#7990) --- docs/config/index.md | 7 ++ packages/vitest/src/node/cli/cli-config.ts | 4 + packages/vitest/src/node/pools/typecheck.ts | 4 +- packages/vitest/src/node/types/config.ts | 5 + packages/vitest/src/typecheck/typechecker.ts | 98 +++++++++++++++----- test/typescript/test/runner.test.ts | 17 ++++ 6 files changed, 111 insertions(+), 24 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 1c7ebf022..9657b98ba 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -2258,6 +2258,13 @@ By default, if Vitest finds source error, it will fail test suite. Path to custom tsconfig, relative to the project root. +#### typecheck.spawnTimeout + +- **Type**: `number` +- **Default**: `10_000` + +Minimum time in milliseconds it takes to spawn the typechecker. + ### slowTestThreshold - **Type**: `number` diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index cd8e14a99..3415c4ebd 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -706,6 +706,10 @@ export const cliOptionsConfig: VitestCLIOptions = { argument: '', normalize: true, }, + spawnTimeout: { + description: 'Minimum time in milliseconds it takes to spawn the typechecker', + argument: '