-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvitest.config.ts
42 lines (38 loc) · 989 Bytes
/
vitest.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
import tsconfigPaths from "vite-tsconfig-paths";
import { defineConfig } from "vitest/config";
/**
* Get the intended boolean value from the given string.
*/
function getBoolean(value: string | undefined) {
if (value === undefined) {
return false;
}
const asNumber = Number(value);
return Number.isNaN(asNumber)
? Boolean(String(value).toLowerCase().replace("false", ""))
: Boolean(asNumber);
}
const testLimitations = getBoolean(process.env["TEST_LIMITATIONS"]);
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
include: ["./**/*.test.ts"],
exclude: [
"dist",
"node_modules",
...(testLimitations ? [] : ["tests/limitations.test.ts"]),
],
coverage: {
all: true,
include: ["src"],
exclude: ["dist"],
reporter: ["lcov", "text"],
watermarks: {
lines: [80, 95],
functions: [80, 95],
branches: [80, 95],
statements: [80, 95],
},
},
},
});