-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.config.ts
More file actions
63 lines (58 loc) · 1.8 KB
/
vitest.config.ts
File metadata and controls
63 lines (58 loc) · 1.8 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
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
/**
* Set a generous timeout for all tests and hooks.
* Tests involving Testcontainers can take a while to start up,
* as they need to pull Docker images and wait for containers to be ready.
* 60 seconds should be more than enough for most cases.
*/
testTimeout: 60_000,
hookTimeout: 60_000,
/**
* Disable global APIs (describe, it, expect, etc.).
* This enforces that all test files must explicitly import these
* functions from 'vitest', leading to more self-contained and readable tests.
*/
globals: false,
/**
* Use the standard 'node' environment.
* Testcontainers works by communicating with the Docker daemon from the Node.js process.
*/
environment: "node",
/**
* Exclude compiled output directories from test runs.
* This is the crucial setting that prevents Vitest from accidentally running tests
* on the compiled JavaScript files in the `lib` directory, which can lead to
* confusing errors when the source and compiled code are out of sync.
*/
exclude: ["**/node_modules/**", "**/lib/**", "**/dist/**", "**/build/**"],
/**
* Code coverage configuration
*/
coverage: {
provider: "v8",
reporter: ["text", "html", "json-summary", "lcov"],
reportsDirectory: "./coverage",
exclude: [
"**/node_modules/**",
"**/lib/**",
"**/dist/**",
"**/build/**",
"**/*.spec.ts",
"**/*.test.ts",
"**/sample/**",
"**/types/**",
"**/*.d.ts",
],
thresholds: {
statements: 60,
branches: 60,
functions: 60,
lines: 60,
},
all: true,
skipFull: false,
},
},
});