import { defineConfig } from 'vitest/config'
import { resolve } from 'path'

/**
 * Vitest config for frontend unit tests.
 *
 * The unit tests cover pure-TS modules (no Vue components) and run in a
 * happy-dom environment so the few modules that touch `window`,
 * `localStorage`, or `__TAURI_INTERNALS__` work the same way as in the
 * browser.
 */
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
  test: {
    environment: 'happy-dom',
    globals: false,
    include: ['tests/unit/**/*.test.ts'],
    // Keep CI noise low: fail fast on the first failure.
    reporters: process.env.CI ? ['default'] : ['default'],
  },
})
