Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions webview-ui/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

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?

hookTimeout: 10000, // 10 seconds for setup/teardown hooks
teardownTimeout: 10000, // 10 seconds for teardown
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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: {
Expand Down
8 changes: 8 additions & 0 deletions webview-ui/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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?

})