Skip to content

Finished tests reported as pending when using retry and repeats #9689

@AriPerkkio

Description

@AriPerkkio

Describe the bug

Finished tests are not reported as passed when using retry + repeats. Removing either one fixes the issue. This happens only on beta release, not on 4.0.x/latest.

import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    reporters: [
      'default',
      {
        onTestRunEnd(testModules) {
          for (const testModule of testModules) {
            for (const test of testModule.children.allTests()) {
              console.log(`[${test.result().state}] ${test.name}`)
            }
          }
        },
      },
    ],
  },
})
import { it } from 'vitest'

it('example', { retry: 2, repeats: 1 }, ({ }) => {})
 ✓ test/retry.test.ts (1 test) 1ms
     example 0ms (repeat x1)

 Test Files  1 passed (1)
      Tests   (1)
   Start at  14:20:12
   Duration  6ms

[pending] example

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-splt12pk?file=test%2Fbasic.test.ts,vite.config.ts,package.json&initialPath=__vitest__/

System Info

Stackblitz

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions