import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'node:url';

export default defineConfig({
  resolve: {
    alias: {
      'astro:middleware': fileURLToPath(new URL('./tests/__stubs/astro-middleware.ts', import.meta.url)),
    },
  },
  test: {
    environment: 'node',
    globals: false,
    pool: 'forks',
    setupFiles: ['./tests/setup.ts'],
    include: ['tests/**/*.test.ts'],
    coverage: {
      provider: 'v8',
      include: ['src/lib/**', 'src/middleware.ts', 'src/pages/api/**'],
      reporter: ['text', 'html'],
    },
  },
});
