-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
114 lines (102 loc) · 2.99 KB
/
vitest.config.ts
File metadata and controls
114 lines (102 loc) · 2.99 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
102
103
104
105
106
107
108
109
110
111
112
113
114
/// <reference types="vitest" />
import { resolve } from "path";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [react()],
// Vitestの設定
test: {
// テスト環境の設定
environment: "happy-dom",
// セットアップファイルの指定
setupFiles: [
"./src/test/setup/setup.ts",
"./src/test/setup/prisma-orm-setup.ts",
"./src/test/setup/auth-js-setup.ts",
"./src/test/setup/tanstack-query-setup.tsx",
],
// グローバル設定
globals: true,
// ファイル並列実行の設定
fileParallelism: true,
// コンソール出力を抑制
silent: true,
// Next.jsとの互換性のための設定
server: {
deps: {
inline: ["next-auth"],
},
},
// カバレッジ設定
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
reportsDirectory: "./coverage",
cleanOnRerun: true,
include: ["src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}", "scripts/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
exclude: [
"node_modules/",
"src/env.ts",
"src/app/layout.tsx",
"src/app/loading.tsx",
"src/app/not-found.tsx",
"src/app/page.tsx",
"src/app/dashboard/**/*",
"src/app/dashboard/**/*",
"src/emails/notification.tsx",
"src/app/api/[...nextauth]/route.ts",
"src/lib/resend.ts",
"src/test/mocks/handlers.ts",
"src/test/msw-mocks/handlers.ts",
"src/test/msw-mocks/server.ts",
"src/test/test-utils/test-utils-prisma-orm.ts",
"**/*.d.ts",
"**/*.config.*",
"**/coverage/**",
"**/dist/**",
"**/.next/**",
"**/prisma/**",
"**/*.test.*",
"**/*.spec.*",
"**/.prettierrc.mjs",
"public/**/*",
"workbox-8817a5e5.js",
"src/lib/zod-schema.ts",
"src/lib/auth-js.ts",
"src/lib/prisma.ts",
"src/lib/redis.ts",
"src/lib/tanstack-query.ts",
"src/lib/constants.ts",
"src/types/**/*",
"src/components/ui/**/*",
"src/app/dashboard/**/*",
"src/test/utils.tsx",
],
// カバレッジ目標値(test.mdの要件に基づく)
thresholds: {
lines: 90,
functions: 85,
branches: 80,
statements: 80,
},
},
// テストファイルのパターン
include: [
"src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
"scripts/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
"src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
],
// 除外するファイル
exclude: ["node_modules", "dist", ".next", "coverage", "prisma"],
// タイムアウト設定
testTimeout: 30000,
hookTimeout: 30000,
},
// パスエイリアスの設定
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"~": resolve(__dirname, "./"),
},
},
});