import { defineConfig } from "vitest/config";
import dotenv from "dotenv";
dotenv.config({ path: ".env.test", override: true });

export default defineConfig({
  test: {
    globals: true,
    environment: "node",
    setupFiles: ["./src/__tests__/setup.ts"],
    testTimeout: 15000,
    hookTimeout: 15000,
    exclude: ["dist/**", "node_modules/**", ".claude/**"],
    // Tests run against a real shared MySQL test DB. Running test files in
    // parallel lets two files (e.g. numbering + manual-create) hit the same
    // `number_sequences` row with SELECT ... FOR UPDATE + deleteMany at once,
    // which deadlocks (MySQL 1213). Serialise files so DB-touching suites
    // don't contend. Tests within a file already run sequentially.
    fileParallelism: false,
  },
});
