From 88cf0a9888b44e45cb0ff785b2ed93c1be8227a5 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Date: Thu, 10 Sep 2026 16:00:39 +0900 Subject: [PATCH] test(runner): move repeat retries to e2e Co-authored-by: Codex (GPT-6) --- test/e2e/test/repeats.test.ts | 38 ++++++++++++++++++++++++++++++ test/unit/test/repeats.test.ts | 42 ---------------------------------- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/test/e2e/test/repeats.test.ts b/test/e2e/test/repeats.test.ts index ab5f61c17..6c5120dc8 100644 --- a/test/e2e/test/repeats.test.ts +++ b/test/e2e/test/repeats.test.ts @@ -25,6 +25,44 @@ test('repeats config option is exposed to tests and repeats execution', async () expect(overridden.diagnostic()!.repeatCount).toBe(1) }) +test('retry count is retained across repeats', async () => { + const { errorTree } = await runInlineTests({ + 'repeats.test.js': ` + import { afterAll, expect, it } from 'vitest' + + const runs = [] + + it('retries each repeat once', { repeats: 2, retry: 1 }, ({ task }) => { + const repeatCount = task.result.repeatCount + const retryCount = task.result.retryCount + runs.push([repeatCount, retryCount]) + if (repeatCount === retryCount) { + throw new Error('retry') + } + }) + + afterAll(() => { + expect(runs).toEqual([ + [0, 0], + [0, 1], + [1, 1], + [1, 2], + [2, 2], + [2, 3], + ]) + }) + `, + }) + + expect(errorTree()).toMatchInlineSnapshot(` + { + "repeats.test.js": { + "retries each repeat once": "passed", + }, + } + `) +}) + test('failed repeats are retained after a successful repeat', async () => { const { errorTree, results } = await runInlineTests({ 'repeats.test.js': ` diff --git a/test/unit/test/repeats.test.ts b/test/unit/test/repeats.test.ts index a26d790c9..ac8f99434 100644 --- a/test/unit/test/repeats.test.ts +++ b/test/unit/test/repeats.test.ts @@ -50,48 +50,6 @@ describe('testing repeats with retry', () => { expect(retryNumbers).toStrictEqual(result) }) }) - - const runs: [repeatCount: number, retryCount: number][] = [] - - test('retries each repeat once', { repeats: 2, retry: 1 }, ({ task }) => { - const repeatCount = task.result!.repeatCount! - const retryCount = task.result!.retryCount! - runs.push([repeatCount, retryCount]) - if (repeatCount === retryCount) { - throw new Error('retry') - } - }) - - test('keeps retry count across repeats', () => { - expect(runs).toMatchInlineSnapshot(` - [ - [ - 0, - 0, - ], - [ - 0, - 1, - ], - [ - 1, - 1, - ], - [ - 1, - 2, - ], - [ - 2, - 2, - ], - [ - 2, - 3, - ], - ] - `) - }) }) const nestedDescribeNumbers: number[] = [] -- 2.51.2