import path from "path";
import { defineConfig } from "vitest/config";

export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  test: {
    watch: false,
    passWithNoTests: true,
    environment: "node",
    include: ["./src/tests/**/*.test.ts"],
    globalSetup: ["./src/tests/utils/setup.ts"],
    testTimeout: 60_000,
    // Setup hooks make network calls; the default timeout is too tight.
    hookTimeout: 60_000,
    // Tests are network-bound, so parallelize on two axes: run several files at
    // once (maxWorkers) and run the independent tests within each file at once
    // (sequence.concurrent). maxConcurrency is set above the largest file's test
    // count so every file fans out fully. Test data is timestamped; rare
    // same-millisecond collisions are accepted.
    maxWorkers: 16,
    maxConcurrency: 10,
    sequence: { concurrent: true },
  },
});
