teqo-backup/vitest.config.mts
Francisco Solla 1a3084a6ee fix(test): keep int gate under Postgres connection ceiling
Cap vitest workers and raise Docker max_connections so high-core laptops
stop failing the suite with cascading "too many clients" / QueryError noise.
2026-08-05 20:29:14 -03:00

31 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import path from 'node:path'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vitest/config'
export default defineConfig({
resolve: {
alias: {
'server-only': path.resolve(process.cwd(), 'tests/helpers/serverOnly.ts'),
},
},
plugins: [tsconfigPaths(), react()],
test: {
environment: 'jsdom',
setupFiles: ['./vitest.setup.ts'],
include: ['tests/int/**/*.int.spec.ts'],
// Cap forks so each worker's Payload pg pool stays under Docker Postgres
// max_connections=100 on high-core laptops (default worker count ≈ CPUs;
// 16× pool-max-10 ≈ 160 clients → "too many clients already", which then
// cascades into unrelated QueryError noise). CI runners have fewer CPUs.
maxWorkers: 8,
// Int specs hit a real Postgres under a parallel suite, so wall time is
// dominated by pool contention, not by the code under test. The 5s
// default made legitimately heavy RSC-composition tests flake as the
// suite grew (municipalityPageData was the first); one global budget
// beats per-test overrides. Genuinely hung tests still fail — just 10s
// later. The unit suite keeps the 5s default.
testTimeout: 15_000,
},
})