vitest.thinking-signature-rectifier.config.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import path from "node:path";
  2. import { defineConfig } from "vitest/config";
  3. /**
  4. * thinking signature 整流器专项覆盖率配置
  5. *
  6. * 目的:
  7. * - 仅统计本次新增的整流器模块,避免把 Next/DB/Redis 等重模块纳入阈值
  8. * - 对“错误整流 + 重试一次”这类稳定性修复设置覆盖率门槛(>= 80%)
  9. */
  10. export default defineConfig({
  11. test: {
  12. globals: true,
  13. environment: "node",
  14. setupFiles: ["./tests/setup.ts"],
  15. include: [
  16. "src/app/v1/_lib/proxy/thinking-signature-rectifier.test.ts",
  17. "tests/unit/proxy/proxy-forwarder-thinking-signature-rectifier.test.ts",
  18. ],
  19. exclude: ["node_modules", ".next", "dist", "build", "coverage", "tests/integration/**"],
  20. coverage: {
  21. provider: "v8",
  22. reporter: ["text", "html", "json"],
  23. reportsDirectory: "./coverage-thinking-signature-rectifier",
  24. include: ["src/app/v1/_lib/proxy/thinking-signature-rectifier.ts"],
  25. exclude: ["node_modules/", "tests/", "**/*.d.ts", ".next/"],
  26. thresholds: {
  27. lines: 80,
  28. functions: 80,
  29. branches: 70,
  30. statements: 80,
  31. },
  32. },
  33. reporters: ["verbose"],
  34. isolate: true,
  35. mockReset: true,
  36. restoreMocks: true,
  37. clearMocks: true,
  38. },
  39. resolve: {
  40. alias: {
  41. "@": path.resolve(__dirname, "./src"),
  42. "server-only": path.resolve(__dirname, "./tests/server-only.mock.ts"),
  43. },
  44. },
  45. });