forked from monkeytypegame/monkeytype
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
37 lines (33 loc) · 980 Bytes
/
Copy pathvitest.config.ts
File metadata and controls
37 lines (33 loc) · 980 Bytes
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
import { defineConfig, UserWorkspaceConfig } from "vitest/config";
import { projects as backendProjects } from "./backend/vitest.config";
import { projects as frontendProjects } from "./frontend/vitest.config";
export default defineConfig({
test: {
projects: [
...convertTests(backendProjects, "backend"),
...convertTests(frontendProjects, "frontend"),
"packages/**/vitest.config.ts",
],
},
});
function convertTests(
projects: unknown[],
root: string,
): UserWorkspaceConfig[] {
return (projects as UserWorkspaceConfig[]).map((it) => {
const test = it.test ?? {};
const name: string | { label: string } = test.name ?? "unknown";
let updatedName =
name === null || typeof name === "string"
? `${name} (${root})`
: { ...name, label: `${name.label} (${root})` };
return {
...it,
test: {
...test,
root,
name: updatedName,
},
} as UserWorkspaceConfig;
});
}