import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    setupFiles: ['./test/setup.js'],
    // Sequential execution: tests share a single test schema and Valkey db, so we
    // serialize to keep state predictable. Switch to per-test transactions or per-test
    // schema if you need parallelism later.
    fileParallelism: false,
    sequence: { concurrent: false },
    // Some tests wait on backend timers (pairing blast, payment expiry sweep, etc).
    testTimeout: 30_000,
    hookTimeout: 30_000,
    include: ['test/**/*.test.js'],
    coverage: {
      provider: 'v8',
      reporter: ['text', 'html'],
      include: ['src/**/*.js'],
      exclude: ['src/server.js', 'src/db/migrate.js', 'src/db/seed.js'],
    },
  },
})
