From a32d934a62ab30160bc6638ec700ea9ad455b09f Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Date: Thu, 10 Sep 2026 16:16:08 +0900 Subject: [PATCH] docs(runner): clarify state widening Co-authored-by: Codex (GPT-6) --- packages/vitest/src/runtime/runner/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vitest/src/runtime/runner/run.ts b/packages/vitest/src/runtime/runner/run.ts index b0b58a6b0..2be9f8965 100644 --- a/packages/vitest/src/runtime/runner/run.ts +++ b/packages/vitest/src/runtime/runner/run.ts @@ -618,7 +618,7 @@ async function runTest(test: Test, runner: VitestRunner): Promise { const repeats = test.repeats ?? 0 let failedRepeatErrors: TestError[] | undefined for (let repeatCount = 0; repeatCount <= repeats; repeatCount++) { - // TypeScript cannot track state mutations made by hooks and the test. + // Force widening to TaskState because TypeScript cannot track mutations made by hooks and the test. test.result.state = 'run' as TaskState test.result.errors = undefined const retry = getRetryCount(test.retry) -- 2.51.2