forked from Samuel1-ona/hunty
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
77 lines (76 loc) · 2.61 KB
/
Copy pathvitest.config.ts
File metadata and controls
77 lines (76 loc) · 2.61 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
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vitest/config";
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
export default defineConfig({
plugins: [react()],
// Vite 8 defaults to oxc, which skips the React plugin's esbuild JSX transform.
// Force automatic JSX runtime so .tsx sources parse under import analysis.
oxc: {
jsx: {
runtime: "automatic",
},
},
test: {
environment: "jsdom",
globals: true,
setupFiles: ["./vitest.setup.ts"],
exclude: ["e2e/**", "node_modules/**"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html", "lcov"],
reportsDirectory: "./coverage",
include: ["lib/**/*.{ts,tsx}", "hooks/**/*.{ts,tsx}"],
exclude: [
"lib/**/__tests__/**",
"hooks/**/__tests__/**",
"**/*.test.{ts,tsx}",
"**/*.spec.{ts,tsx}",
"**/*.d.ts",
"vitest.setup.ts",
"**/*.config.*",
],
thresholds: {
lines: 80,
functions: 80,
branches: 80,
statements: 80,
},
},
},
resolve: {
alias: {
"@hunty/config": path.resolve(__dirname, "../../packages/config"),
"@hunty/config/*": path.resolve(__dirname, "../../packages/config/*"),
"@hunty/types/schemas": path.resolve(__dirname, "../../packages/types/src/schemas.ts"),
"@hunty/types": path.resolve(__dirname, "../../packages/types/src/index.ts"),
"@": path.resolve(__dirname, "./"),
},
// Keep subpath aliases ahead of the package root alias. Vite matches
// aliases by prefix, so @hunty/types would otherwise swallow
// @hunty/types/api-schemas.
alias: [
// @upstash/redis is an optional runtime dependency not installed in the
// dev/test environment. Redirect it to a lightweight stub so Vite's
// static import-analysis does not fail when it encounters the dynamic
// `await import("@upstash/redis")` inside lib/rate-limit.ts.
{
find: "@upstash/redis",
replacement: path.resolve(__dirname, "./__mocks__/@upstash/redis.ts"),
},
{
find: "@hunty/types/api-schemas",
replacement: path.resolve(__dirname, "../../packages/types/src/api-schemas.ts"),
},
{
find: "@hunty/types/schemas",
replacement: path.resolve(__dirname, "../../packages/types/src/schemas.ts"),
},
{
find: "@hunty/types",
replacement: path.resolve(__dirname, "../../packages/types/src/index.ts"),
},
{ find: "@", replacement: path.resolve(__dirname, "./") },
],
},
});