Updated the Vitest configuration to increase test and hook timeouts to 20 seconds, addressing flaky tests under pre-push load. Additionally, improved test cleanup procedures across multiple test files by ensuring mocks are cleared after each test, enhancing test reliability and maintainability.
32 lines
808 B
TypeScript
32 lines
808 B
TypeScript
import { fileURLToPath } from 'node:url'
|
|
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('.', import.meta.url)),
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
include: ['**/*.test.{ts,tsx}'],
|
|
setupFiles: ['./vitest.setup.ts'],
|
|
// Default 5s flakes under pre-push load (jsdom + HeroUI transform); aborted
|
|
// tests then leak async work into the next case in the same file.
|
|
testTimeout: 20_000,
|
|
hookTimeout: 20_000,
|
|
maxWorkers: '50%',
|
|
coverage: {
|
|
provider: 'v8',
|
|
include: ['lib/authRouting.ts', 'helpers/listResponse.ts', 'validation/auth.ts'],
|
|
thresholds: {
|
|
branches: 80,
|
|
functions: 80,
|
|
lines: 80,
|
|
statements: 80,
|
|
},
|
|
},
|
|
},
|
|
})
|