Integration tests use makePort() which writes ports with slug 'test-port-{rand}'
and never cleans up. Result: 17,564 leaked rows in dev that slowed every page
load fetching the port-switcher list (and was contributing to smoke flakes).
Adds tests/global-setup.ts with a teardown() that DELETEs every 'test-port-%'
row plus its dependent rows across 30+ tables in one CTE. Wires it into
vitest.config.ts via globalSetup. Adds closeDb() helper so the teardown can
end the postgres-js pool cleanly (kills the 'Tests closed but Vite server
won't exit' warning).
Also lands docs/superpowers/specs/2026-04-28-country-phone-timezone-design.md
— full-scope agenda for the country dropdown / E.164 phone input /
country-driven timezone autofill work, ~7 dev days across 10 PRs. Per
user request: 'let's do this full-fledged if we're gonna do it'.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
813 B
TypeScript
27 lines
813 B
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'path';
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
const { loadEnv } = require('vite');
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: 'node',
|
|
include: ['tests/unit/**/*.test.ts', 'tests/integration/**/*.test.ts'],
|
|
exclude: ['tests/e2e/**', 'node_modules/**'],
|
|
pool: 'forks',
|
|
globalSetup: ['./tests/global-setup.ts'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'lcov', 'json-summary'],
|
|
include: ['src/lib/**'],
|
|
exclude: ['src/lib/db/migrations/**', 'src/lib/db/schema/**', 'src/**/*.d.ts'],
|
|
},
|
|
testTimeout: 30_000,
|
|
env: loadEnv('test', process.cwd(), ''),
|
|
},
|
|
resolve: {
|
|
alias: { '@': path.resolve(__dirname, './src') },
|
|
},
|
|
});
|