From 8073168b0ac2d83beb87830acd419cd8863f911c Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Date: Thu, 10 Sep 2026 16:15:29 +0900 Subject: [PATCH] docs(runner): explain state widening Co-authored-by: Codex (GPT-6) --- packages/vitest/src/runtime/runner/run.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vitest/src/runtime/runner/run.ts b/packages/vitest/src/runtime/runner/run.ts index 8baf1543a..b0b58a6b0 100644 --- a/packages/vitest/src/runtime/runner/run.ts +++ b/packages/vitest/src/runtime/runner/run.ts @@ -618,6 +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. test.result.state = 'run' as TaskState test.result.errors = undefined const retry = getRetryCount(test.retry) -- 2.51.2