forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vitest.workspace.ts
96 lines (92 loc) · 2.97 KB
/
vitest.workspace.ts
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { defineWorkspace } from "vitest/config";
const packagedEmbedTestsOnly = process.argv.includes("--packaged-embed-tests-only");
const timeZoneDependentTestsOnly = process.argv.includes("--timeZoneDependentTestsOnly");
// eslint-disable-next-line turbo/no-undeclared-env-vars
const envTZ = process.env.TZ;
if (timeZoneDependentTestsOnly && !envTZ) {
throw new Error("TZ environment variable is not set");
}
// defineWorkspace provides a nice type hinting DX
const workspaces = packagedEmbedTestsOnly
? [
{
test: {
include: ["packages/embeds/**/*.{test,spec}.{ts,js}"],
environment: "jsdom",
},
},
]
: // It doesn't seem to be possible to fake timezone per test, so we rerun the entire suite with different TZ. See https://github.com/vitest-dev/vitest/issues/1575#issuecomment-1439286286
timeZoneDependentTestsOnly
? [
{
test: {
name: `TimezoneDependentTests:${envTZ}`,
include: ["packages/**/*.timezone.test.ts", "apps/**/*.timezone.test.ts"],
// TODO: Ignore the api until tests are fixed
exclude: ["**/node_modules/**/*", "packages/embeds/**/*"],
setupFiles: ["setupVitest.ts"],
},
},
]
: [
{
test: {
include: ["packages/**/*.{test,spec}.{ts,js}", "apps/**/*.{test,spec}.{ts,js}"],
exclude: [
"**/node_modules/**/*",
"**/.next/**/*",
"packages/embeds/**/*",
"packages/lib/hooks/**/*",
"packages/platform/**/*",
"apps/api/v2/**/*",
],
name: "@calcom/core",
setupFiles: ["setupVitest.ts"],
},
},
{
test: {
globals: true,
name: "@calcom/features",
include: ["packages/features/**/*.{test,spec}.tsx"],
environment: "jsdom",
setupFiles: ["setupVitest.ts"],
},
},
{
test: {
name: "@calcom/closecom",
include: ["packages/app-store/closecom/**/*.{test,spec}.{ts,js}"],
environment: "jsdom",
setupFiles: ["packages/app-store/closecom/test/globals.ts"],
},
},
{
test: {
globals: true,
name: "@calcom/ui",
include: ["packages/ui/components/**/*.{test,spec}.[jt]s?(x)"],
environment: "jsdom",
setupFiles: ["packages/ui/components/test-setup.ts"],
},
},
{
test: {
globals: true,
name: "EventTypeAppCardInterface components",
include: ["packages/app-store/_components/**/*.{test,spec}.[jt]s?(x)"],
environment: "jsdom",
setupFiles: ["packages/app-store/test-setup.ts"],
},
},
{
test: {
name: "@calcom/packages/lib/hooks",
include: ["packages/lib/hooks/**/*.{test,spec}.{ts,js}"],
environment: "jsdom",
setupFiles: [],
},
},
];
export default defineWorkspace(workspaces);