From 3d83a66977a93e09c8a6109c6cbd86f40065d734 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Date: Thu, 10 Sep 2026 17:03:43 +0900 Subject: [PATCH] test(runner): cover fails across repeats Co-authored-by: Codex (GPT-6) --- test/e2e/test/repeats.test.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/e2e/test/repeats.test.ts b/test/e2e/test/repeats.test.ts index 6c5120dc8..3079d6a43 100644 --- a/test/e2e/test/repeats.test.ts +++ b/test/e2e/test/repeats.test.ts @@ -126,3 +126,37 @@ test('onTestFailed runs only for failed repeats', async () => { } `) }) + +test('expected failures are evaluated for each repeat', async () => { + const { errorTree } = await runInlineTests({ + 'repeats.test.js': ` + import { afterAll, expect, it } from 'vitest' + + const runs = [0, 0, 0, 0, 0] + + it.fails('alternates passing and failing repeats', { repeats: 4 }, ({ task }) => { + const repeatCount = task.result.repeatCount + runs[repeatCount]++ + if (repeatCount % 2 === 1) { + throw new Error('repeat ' + repeatCount + ' failed') + } + }) + + afterAll(() => { + expect(runs).toEqual([1, 1, 1, 1, 1]) + }) + `, + }) + + expect(errorTree()).toMatchInlineSnapshot(` + { + "repeats.test.js": { + "alternates passing and failing repeats": [ + "Expect test to fail", + "Expect test to fail", + "Expect test to fail", + ], + }, + } + `) +}) -- 2.51.2