-
-
Notifications
You must be signed in to change notification settings - Fork 449
Expand file tree
/
Copy pathvitest.config.ts
More file actions
99 lines (96 loc) · 2.83 KB
/
vitest.config.ts
File metadata and controls
99 lines (96 loc) · 2.83 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
import path from "node:path";
import {TestUserConfig, defineConfig} from "vitest/config";
import {browserTestProject} from "./configs/vitest.config.browser.js";
import {e2eMainnetProject, e2eMinimalProject} from "./configs/vitest.config.e2e.js";
import {specProjectMainnet, specProjectMinimal} from "./configs/vitest.config.spec.js";
import {typesTestProject} from "./configs/vitest.config.types.js";
import {unitTestMainnetProject, unitTestMinimalProject} from "./configs/vitest.config.unit.js";
import {esmCjsInteropPlugin} from "./scripts/vite/plugins/esmCjsInteropPlugin.js";
export function getReporters(): TestUserConfig["reporters"] {
if (process.env.GITHUB_ACTIONS) return ["tree", "hanging-process", "github-actions"];
if (process.env.TEST_COMPACT_OUTPUT) return ["basic", "hanging-process"];
return ["tree", "hanging-process"];
}
export default defineConfig({
plugins: [esmCjsInteropPlugin()],
test: {
projects: [
{
extends: true,
...unitTestMinimalProject,
},
{
extends: true,
...unitTestMainnetProject,
},
{
extends: true,
...browserTestProject,
},
{
extends: true,
...e2eMinimalProject,
},
{
extends: true,
...e2eMainnetProject,
},
{
extends: true,
...specProjectMinimal,
},
{
extends: true,
...specProjectMainnet,
},
{
extends: true,
...typesTestProject,
},
],
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.*",
],
env: {
NODE_ENV: "test",
},
clearMocks: true,
// Some test files allocate a lot of data, which could cause more time for teardown
teardownTimeout: 5_000,
// We have a few spec tests suits (specially spec tests) which don't have individual tests
passWithNoTests: true,
reporters: getReporters(),
diff: process.env.TEST_COMPACT_DIFF
? path.join(import.meta.dirname, "../scripts/vitest/vitest.diff.ts")
: undefined,
onConsoleLog: () => !process.env.TEST_QUIET_CONSOLE,
coverage: {
enabled: false,
include: ["packages/**/src/**.{ts}"],
clean: true,
provider: "v8",
reporter: [["lcovonly", {file: "lcov.info"}], ["text"]],
reportsDirectory: "./coverage",
exclude: [
"**/*.d.ts",
"**/*.js",
"**/lib/**",
"**/coverage/**",
"**/scripts/**",
"**/test/**",
"**/types/**",
"**/bin/**",
"**/node_modules/**",
"**/spec-tests/**",
"**/spec-tests-bls/**",
],
},
},
});