import path from 'node:path';
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'resources/js'),
      '~': path.resolve(__dirname, 'resources/css'),
      // Tamagui's react-native-web-lite imports a directory entry; point to the ESM file explicitly for Vitest.
      '@tamagui/react-native-web-lite/dist/esm/vendor/react-native/deepDiffer':
        path.resolve(__dirname, 'node_modules/@tamagui/react-native-web-lite/dist/esm/vendor/react-native/deepDiffer/index.mjs'),
    },
  },
  test: {
    environment: 'jsdom',
    globals: true,
    setupFiles: ['./resources/js/setupTests.ts'],
    css: false,
    include: ['resources/js/**/*.test.{ts,tsx}'],
    reporters: 'default',
    coverage: {
      provider: 'v8',
      reportsDirectory: './coverage/unit',
      include: ['resources/js/admin/**/*.{ts,tsx}'],
    },
  },
});
