forked from ding113/claude-code-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.include-session-id-in-errors.config.ts
More file actions
59 lines (52 loc) · 1.63 KB
/
vitest.include-session-id-in-errors.config.ts
File metadata and controls
59 lines (52 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import path from "node:path";
import { defineConfig } from "vitest/config";
/**
* Include CCH session id in client errors - scoped coverage config
*
* 目的:
* - 验证错误响应中附带 sessionId 的行为(message + header)
* - 覆盖率只统计本次改动相关模块,避免引入 Next/DB/Redis 重模块
* - 覆盖率阈值:>= 90%
*/
export default defineConfig({
test: {
globals: true,
environment: "happy-dom",
setupFiles: ["./tests/setup.ts"],
include: [
"tests/unit/proxy/responses-session-id.test.ts",
"tests/unit/proxy/proxy-handler-session-id-error.test.ts",
"tests/unit/proxy/error-handler-session-id-error.test.ts",
"tests/unit/proxy/chat-completions-handler-guard-pipeline.test.ts",
],
exclude: ["node_modules", ".next", "dist", "build", "coverage", "tests/integration/**"],
coverage: {
provider: "v8",
reporter: ["text", "html", "json"],
reportsDirectory: "./coverage-include-session-id-in-errors",
include: [
"src/app/v1/_lib/proxy/error-session-id.ts",
"src/app/v1/_lib/proxy-handler.ts",
"src/app/v1/_lib/codex/chat-completions-handler.ts",
],
exclude: ["node_modules/", "tests/", "**/*.d.ts", ".next/"],
thresholds: {
lines: 90,
functions: 90,
branches: 90,
statements: 90,
},
},
reporters: ["verbose"],
isolate: true,
mockReset: true,
restoreMocks: true,
clearMocks: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"server-only": path.resolve(__dirname, "./tests/server-only.mock.ts"),
},
},
});