Skip to content

test(cli): retry flaky subprocess tests in CI#39

Merged
vianmora merged 1 commit into
developfrom
fix/flaky-test-retry
Jul 18, 2026
Merged

test(cli): retry flaky subprocess tests in CI#39
vianmora merged 1 commit into
developfrom
fix/flaky-test-retry

Conversation

@vianmora

Copy link
Copy Markdown
Collaborator

Problem

packages/cli/evaluations/high-impact/fixture-api.test.ts intermittently fails with Test timed out in 15000ms. It spawns two CLI subprocesses (cold-start via tsx) against a local fixture API; on a loaded runner the two cold starts occasionally exceed the default 15s timeout. Seen on unrelated PRs (#36, #38), each time green on re-run — i.e. flaky, not a real regression.

Fix

Add test.retry: process.env.CI ? 2 : 0 to packages/cli/vite.config.ts. In CI a transient timeout gets up to 3 attempts; a genuinely broken test still fails all three. Local runs stay strict.

  • The import switches to defineConfig from vitest/config (superset of vite's — the build block is unaffected) so the test field type-checks.
  • Verified empirically that a test.retry here does apply to this package's tests, whereas the root vitest.config.ts does not (vitest loads the package-local vite.config.ts).

Note

This is upstream's flaky test; the fix is generic and worth contributing upstream so it stops being fork divergence.

🤖 Generated with Claude Code

The evaluations/high-impact/* tests spawn CLI subprocesses and occasionally
exceed the 15s timeout on a loaded runner (observed intermittently on unrelated
PRs). Add `retry: 2` in CI to vitest's config for this package so a transient
timeout is absorbed; a genuinely broken test still fails all attempts. Local
runs stay strict (retry: 0).

Verified the retry applies from packages/cli/vite.config.ts (the config vitest
actually loads for this package — the root vitest.config.ts does not reach it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vianmora
vianmora merged commit db198c6 into develop Jul 18, 2026
13 checks passed
@vianmora
vianmora deleted the fix/flaky-test-retry branch July 18, 2026 00:09
vianmora added a commit that referenced this pull request Jul 20, 2026
The evaluations/high-impact/* tests spawn CLI subprocesses and occasionally
exceed the 15s timeout on a loaded runner (observed intermittently on unrelated
PRs). Add `retry: 2` in CI to vitest's config for this package so a transient
timeout is absorbed; a genuinely broken test still fails all attempts. Local
runs stay strict (retry: 0).

Verified the retry applies from packages/cli/vite.config.ts (the config vitest
actually loads for this package — the root vitest.config.ts does not reach it).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant