2
0

vitest.logs-sessionid-time-filter.config.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import path from "node:path";
  2. import { defineConfig } from "vitest/config";
  3. /**
  4. * Dashboard Logs(Session ID + 秒级时间筛选)专项覆盖率配置
  5. *
  6. * 目的:
  7. * - 仅统计本需求可纯函数化/可隔离模块的覆盖率(>= 90%)
  8. * - 仍然执行关键回归相关的单测集合,避免只跑“指标好看”的子集
  9. */
  10. export default defineConfig({
  11. test: {
  12. globals: true,
  13. environment: "happy-dom",
  14. setupFiles: ["./tests/setup.ts"],
  15. include: [
  16. "tests/unit/repository/usage-logs-sessionid-filter.test.ts",
  17. "tests/unit/repository/usage-logs-sessionid-suggestions.test.ts",
  18. "tests/unit/dashboard-logs-query-utils.test.ts",
  19. "tests/unit/dashboard-logs-time-range-utils.test.ts",
  20. "tests/unit/dashboard-logs-filters-time-range.test.tsx",
  21. "tests/unit/dashboard-logs-sessionid-suggestions-ui.test.tsx",
  22. "tests/unit/dashboard-logs-virtualized-special-settings-ui.test.tsx",
  23. "src/app/[locale]/dashboard/logs/_components/usage-logs-table.test.tsx",
  24. ],
  25. exclude: ["node_modules", ".next", "dist", "build", "coverage", "tests/integration/**"],
  26. coverage: {
  27. provider: "v8",
  28. reporter: ["text", "html", "json", "lcov"],
  29. reportsDirectory: "./coverage-logs-sessionid-time-filter",
  30. include: [
  31. "src/app/[locale]/dashboard/logs/_utils/logs-query.ts",
  32. "src/app/[locale]/dashboard/logs/_utils/time-range.ts",
  33. ],
  34. exclude: ["node_modules/", "tests/", "**/*.d.ts", ".next/"],
  35. thresholds: {
  36. lines: 90,
  37. functions: 90,
  38. branches: 90,
  39. statements: 90,
  40. },
  41. },
  42. reporters: ["verbose"],
  43. isolate: true,
  44. mockReset: true,
  45. restoreMocks: true,
  46. clearMocks: true,
  47. },
  48. resolve: {
  49. alias: {
  50. "@": path.resolve(__dirname, "./src"),
  51. "server-only": path.resolve(__dirname, "./tests/server-only.mock.ts"),
  52. },
  53. },
  54. });