vitest.config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { defineConfig } from "vitest/config"
  2. import path from "path"
  3. export default defineConfig({
  4. test: {
  5. // Test file patterns
  6. include: ["src/**/*.test.ts", "src/**/*.test.tsx", "integration-tests/**/*.test.ts"],
  7. // Timeout for tests (integration tests may take longer)
  8. testTimeout: 30000,
  9. // Run tests sequentially to avoid conflicts with temp directories
  10. pool: "forks",
  11. poolOptions: {
  12. forks: {
  13. singleFork: true,
  14. },
  15. },
  16. // Global setup/teardown
  17. globals: true,
  18. // Coverage configuration
  19. coverage: {
  20. provider: "v8",
  21. reporter: ["text", "json", "html"],
  22. exclude: ["node_modules/**", "dist/**", "integration-tests/**", "**/*.test.ts", "**/*.config.*"],
  23. },
  24. // Environment
  25. environment: "node",
  26. // Reporters
  27. reporters: ["verbose"],
  28. // Ensure workspace dependencies are properly resolved
  29. deps: {
  30. optimizer: {
  31. web: {
  32. // Don't try to optimize workspace packages
  33. exclude: ["@kilocode/agent-runtime", "@kilocode/core-schemas"],
  34. },
  35. },
  36. },
  37. },
  38. // Ensure workspace packages are resolved correctly
  39. resolve: {
  40. // Resolve workspace packages from their source
  41. conditions: ["import", "module", "default"],
  42. alias: {
  43. // Resolve agent-runtime from source during tests (avoids needing dist/ to exist)
  44. "@kilocode/agent-runtime": path.resolve(__dirname, "../packages/agent-runtime/src"),
  45. },
  46. },
  47. })