-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
47 lines (46 loc) · 1.07 KB
/
vitest.config.ts
File metadata and controls
47 lines (46 loc) · 1.07 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
import { readFileSync } from "node:fs";
import { loadEnv } from "vite";
import { defineConfig } from "vitest/config";
export default defineConfig(({ mode }) => ({
esbuild: {
tsconfigRaw: "{}",
},
plugins: [
{
name: "template-loader",
transform(_code, id) {
if (id.endsWith(".template")) {
const content = readFileSync(id, "utf-8");
return `export default ${JSON.stringify(content)}`;
}
},
},
],
test: {
// Don't load .env in CI - tests must use fixture cache only
env: process.env.CI === "true" ? {} : loadEnv(mode, process.cwd(), ""),
globals: true,
include: ["src/**/*.test.ts", "tests/**/*.test.ts"],
exclude: ["src/cli/e2e/**/*.test.ts", "node_modules/**"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
include: ["src/**/*.ts"],
exclude: [
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/cli.ts",
"src/cli/**/*.ts",
"src/index.ts",
"src/export/index.ts",
"src/types.ts",
],
thresholds: {
statements: 90,
branches: 80,
functions: 90,
lines: 90,
},
},
},
}));