-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
101 lines (95 loc) · 2.54 KB
/
vitest.config.ts
File metadata and controls
101 lines (95 loc) · 2.54 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
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
97
98
99
100
101
import { existsSync, readdirSync } from "node:fs";
import { defineConfig } from "vitest/config";
const root = new URL("./", import.meta.url).pathname;
const pkgRoot = (pkg: string) =>
new URL(`./packages/${pkg}`, import.meta.url).pathname;
const alias = (pkg: string) => `${pkgRoot(pkg)}/src`;
const aliases = readdirSync(new URL("./packages", import.meta.url).pathname)
.filter((dir) => existsSync(pkgRoot(dir) + "/package.json"))
.reduce<Record<string, string>>(
(acc, pkg) => {
acc[`@mojis/${pkg}`] = alias(pkg);
return acc;
},
{
"#msw-utils": `${root}/test/msw-utils/msw.ts`,
});
const hiddenLogs = [
"[shortcodes]",
"[versions]",
]
export default defineConfig({
test: {
coverage: {
provider: "v8",
include: ["**/src/**"],
},
setupFiles: [
"./test/global-setup/msw.ts",
],
onConsoleLog(log, type) {
if (type === "stderr") {
return !hiddenLogs.some((hidden) => log.includes(hidden));
}
return false;
},
workspace: [
{
extends: true,
test: {
include: ["./packages/internal-utils/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
name: "internal-utils",
environment: "node",
mockReset: true,
},
esbuild: { target: "es2020" },
resolve: { alias: aliases },
},
{
extends: true,
test: {
include: [
"./packages/adapters/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
name: "adapters",
environment: "node",
mockReset: true,
},
esbuild: { target: "es2020" },
resolve: { alias: aliases },
},
{
extends: true,
test: {
include: ["./packages/cli/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
name: "cli",
environment: "node",
mockReset: true,
},
esbuild: { target: "es2020" },
resolve: { alias: aliases },
},
{
extends: true,
test: {
include: ["./packages/parsers/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
name: "parsers",
environment: "node",
mockReset: true,
},
esbuild: { target: "es2020" },
resolve: { alias: aliases },
},
{
extends: true,
test: {
include: ["./packages/schemas/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
name: "schemas",
environment: "node",
mockReset: true,
},
esbuild: { target: "es2020" },
resolve: { alias: aliases },
}
]
}
})