-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathvitest.base.unit.config.ts
68 lines (62 loc) · 1.71 KB
/
vitest.base.unit.config.ts
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
import path from "node:path";
import { defineConfig, ViteUserConfig } from "vitest/config";
const __dirname = new URL(".", import.meta.url).pathname;
export type Runtime = "node" | "deno" | "bun";
export function getRuntime(): Runtime {
if ("bun" in process.versions) return "bun";
if ("deno" in process.versions) return "deno";
return "node";
}
export function getPoolOptions(runtime: Runtime): ViteUserConfig["test"] {
if (runtime === "node") {
return {
pool: "threads",
poolOptions: {
threads: {
singleThread: true,
minThreads: 2,
maxThreads: 10,
},
},
coverage: {
enabled: true,
},
reporters: process.env.GITHUB_ACTIONS
? ["verbose", "hanging-process", "github-actions"]
: [
process.env.TEST_COMPACT_OUTPUT ? "basic" : "verbose",
"hanging-process",
],
};
}
return {
pool: "vitest-in-process-pool",
reporters: [["default", { summary: false }]],
coverage: {
enabled: false,
},
};
}
export default defineConfig({
test: {
...getPoolOptions(getRuntime()),
include: ["**/*.test.ts"],
exclude: [
"**/spec-tests/**",
"**/spec-tests-bls/**",
"**/*.browser.test.ts",
"**/node_modules/**",
"**/dist/**",
"**/cypress/**",
"**/.{idea,git,cache,output,temp}/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
],
setupFiles: [path.join(__dirname, "./vitest/setupFiles/customMatchers.ts")],
coverage: {
reporter: ["clover", "text"],
},
testTimeout: 15000,
hookTimeout: 15000,
onConsoleLog: () => !process.env.TEST_QUIET_CONSOLE,
},
});