-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: add timeout configurations to prevent flaky tests in CI #6442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,12 @@ export default defineConfig({ | |
| silent: true, | ||
| environment: "jsdom", | ||
| include: ["src/**/*.spec.ts", "src/**/*.spec.tsx"], | ||
| // Add timeout configurations to prevent flaky tests in CI | ||
| testTimeout: 15000, // 15 seconds for individual tests (increased from default 5s) | ||
| hookTimeout: 10000, // 10 seconds for setup/teardown hooks | ||
| teardownTimeout: 10000, // 10 seconds for teardown | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This teardownTimeout configuration is missing from src/vitest.config.ts. If teardown timeouts are needed for CI stability, shouldn't both test suites have this configuration? |
||
| // Retry flaky tests once in CI environments | ||
| retry: process.env.CI ? 1 : 0, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This retry logic for CI environments is missing from src/vitest.config.ts. If CI flakiness is a project-wide issue, wouldn't both test suites benefit from retry logic? |
||
| }, | ||
| resolve: { | ||
| alias: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,3 +66,11 @@ afterAll(() => { | |
| console.warn = originalConsoleWarn | ||
| console.info = originalConsoleInfo | ||
| }) | ||
|
|
||
| // Set default timeout for waitFor operations to prevent hanging | ||
| import { configure } from "@testing-library/react" | ||
|
|
||
| configure({ | ||
| // Reduce default timeout for waitFor to fail faster in CI | ||
| asyncUtilTimeout: 5000, // 5 seconds instead of default 1000ms | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This asyncUtilTimeout configuration only affects webview-ui tests. Are there similar async utilities used in src tests that might benefit from timeout configuration? |
||
| }) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout values here (15s/10s) are inconsistent with src/vitest.config.ts which uses 20s/20s. Should these be aligned for consistency across the project? If there's a specific reason for different timeouts, could we document it in comments?