-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
105 lines (102 loc) · 2.71 KB
/
vitest.config.ts
File metadata and controls
105 lines (102 loc) · 2.71 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
/// <reference types="vitest" />
import { fileURLToPath, URL } from "node:url";
import react from "@vitejs/plugin-react";
import { playwright } from "@vitest/browser-playwright";
import { defineConfig } from "vitest/config";
const isBrowserTestsEnabled = process.env.VITEST_BROWSER === "true";
const alias = {
"@": fileURLToPath(new URL("./src", import.meta.url)),
"@data": fileURLToPath(new URL("./data", import.meta.url)),
};
export default defineConfig({
test: {
globals: true,
coverage: {
provider: "v8",
reporter: ["text", "json", "html", "lcov", "cobertura"],
include: ["src/**/*.{ts,tsx}"],
exclude: [
"**/node_modules/**",
"**/dist/**",
"**/.next/**",
"**/coverage/**",
"**/*.config.*",
"**/*.d.ts",
"scripts/**",
"**/*.test.{js,ts,jsx,tsx}",
"**/*.spec.{js,ts,jsx,tsx}",
"**/vitest.config.*",
"**/coverage.config.*",
],
thresholds: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
},
projects: [
...(isBrowserTestsEnabled
? [
{
resolve: {
alias,
},
plugins: react(),
test: {
name: "browser",
include: [
"**/*.browser.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
],
setupFiles: ["./tests/setup.browser.ts"],
browser: {
enabled: true,
provider: playwright(),
headless: true,
instances: [
{
browser: "chromium" as const,
},
],
},
},
},
]
: []),
{
resolve: {
alias,
},
test: {
name: "react-hooks",
include: ["**/playthroughs.test.ts", "**/playthroughs/**/*.test.ts"],
setupFiles: ["./tests/setup.react-hooks.ts"],
environment: "jsdom",
pool: "threads",
},
},
{
resolve: {
alias,
},
test: {
name: "node",
include: ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
exclude: [
"**/*.browser.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
"**/playthroughs.test.ts",
"**/playthroughs/**/*.test.ts",
"**/scrollToLocation.test.ts",
"**/.opencode/**",
"node_modules",
"dist",
".next",
],
environment: "node",
},
},
],
},
});