Skip to content

Commit ebadc1c

Browse files
committed
fix: add timeout configurations to prevent flaky tests in CI
- Add explicit test timeout (15s), hook timeout (10s), and teardown timeout (10s) to vitest config - Configure retry logic for CI environments to handle occasional flaky tests - Add asyncUtilTimeout configuration to testing library to fail faster - Resolves issue where tests would hang indefinitely in CI showing dots continuously Fixes the flaky test issue reported in GitHub Actions run 16625858640
1 parent 6f9fea3 commit ebadc1c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

webview-ui/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export default defineConfig({
1010
silent: true,
1111
environment: "jsdom",
1212
include: ["src/**/*.spec.ts", "src/**/*.spec.tsx"],
13+
// Add timeout configurations to prevent flaky tests in CI
14+
testTimeout: 15000, // 15 seconds for individual tests (increased from default 5s)
15+
hookTimeout: 10000, // 10 seconds for setup/teardown hooks
16+
teardownTimeout: 10000, // 10 seconds for teardown
17+
// Retry flaky tests once in CI environments
18+
retry: process.env.CI ? 1 : 0,
1319
},
1420
resolve: {
1521
alias: {

webview-ui/vitest.setup.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,11 @@ afterAll(() => {
6666
console.warn = originalConsoleWarn
6767
console.info = originalConsoleInfo
6868
})
69+
70+
// Set default timeout for waitFor operations to prevent hanging
71+
import { configure } from "@testing-library/react"
72+
73+
configure({
74+
// Reduce default timeout for waitFor to fail faster in CI
75+
asyncUtilTimeout: 5000, // 5 seconds instead of default 1000ms
76+
})

0 commit comments

Comments
 (0)