// Browser-mode vitest config. Separate from the jsdom suite in vite.config.js
// so we never accidentally cross-pollute environments. Includes only
// component-level tests under src/lib/ui/** and src/lib/shell/**, the
// new homes for v0.2 primitives and the split shell.
import { defineConfig } from "vitest/config";
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";
import { playwright } from "@vitest/browser-playwright";

export default defineConfig({
  plugins: [sveltekit(), tailwindcss()],
  test: {
    include: [
      "src/lib/ui/**/*.browser.{test,spec}.{ts,js,svelte}",
      "src/lib/shell/**/*.browser.{test,spec}.{ts,js,svelte}",
      "src/lib/utils/**/*.browser.{test,spec}.{ts,js}",
    ],
    exclude: ["src-tauri/**", "node_modules/**", "build/**", ".svelte-kit/**"],
    browser: {
      enabled: true,
      provider: playwright(),
      headless: true,
      instances: [{ browser: "chromium" }],
    },
    restoreMocks: true,
    clearMocks: true,
    unstubAllGlobals: true,
  },
});
