forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.unit-paths.mjs
More file actions
46 lines (40 loc) · 1.21 KB
/
vitest.unit-paths.mjs
File metadata and controls
46 lines (40 loc) · 1.21 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
import path from "node:path";
export const unitTestIncludePatterns = [
"src/**/*.test.ts",
"test/**/*.test.ts",
"ui/src/ui/app-chat.test.ts",
"ui/src/ui/views/agents-utils.test.ts",
"ui/src/ui/views/chat.test.ts",
"ui/src/ui/views/usage-render-details.test.ts",
"ui/src/ui/controllers/agents.test.ts",
"ui/src/ui/controllers/chat.test.ts",
];
export const unitTestAdditionalExcludePatterns = [
"src/gateway/**",
"extensions/**",
"src/browser/**",
"src/line/**",
"src/agents/**",
"src/auto-reply/**",
"src/commands/**",
];
const sharedBaseExcludePatterns = [
"dist/**",
"apps/macos/**",
"apps/macos/.build/**",
"**/node_modules/**",
"**/vendor/**",
"dist/OpenClaw.app/**",
"**/*.live.test.ts",
"**/*.e2e.test.ts",
];
const normalizeRepoPath = (value) => value.split(path.sep).join("/");
const matchesAny = (file, patterns) => patterns.some((pattern) => path.matchesGlob(file, pattern));
export function isUnitConfigTestFile(file) {
const normalizedFile = normalizeRepoPath(file);
return (
matchesAny(normalizedFile, unitTestIncludePatterns) &&
!matchesAny(normalizedFile, sharedBaseExcludePatterns) &&
!matchesAny(normalizedFile, unitTestAdditionalExcludePatterns)
);
}