-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvitest.config.ts
71 lines (64 loc) · 1.69 KB
/
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
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
import path, { resolve } from "path";
import react from "@vitejs/plugin-react";
import svgr from "vite-plugin-svgr";
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [
svgr({
svgrOptions: {
template: (variables, { tpl, options }) => {
const assetName = path.basename((options.state as any).filePath);
const templateResult = tpl`
import {createElement} from "react";
${variables.imports};
${variables.interfaces};
const ${variables.componentName} = (${variables.props}) =>
createElement(
'svg',
Object.assign({}, props),
${JSON.stringify(assetName)}
);
${variables.exports};
`;
return templateResult;
},
},
include: "**/*.svg",
}),
react(),
],
resolve: {
alias: {
"@common": resolve("src/common"),
"@main": resolve("src/main"),
"@preload": resolve("src/preload"),
"@renderer": resolve("src/renderer/src"),
},
},
define: {
APP_VERSION: JSON.stringify("9.9.9"), // use a fixed version to avoid constant snapshots mismatch
},
test: {
css: {
modules: {
classNameStrategy: "non-scoped",
},
},
dir: "./src",
environment: "jsdom",
setupFiles: "src/setupTests.ts",
globals: true,
coverage: {
include: ["src/*"],
exclude: ["**/__mocks__/*"],
all: true,
enabled: true,
provider: "istanbul",
reporter: ["lcov", "text"],
lines: 5,
functions: 5,
branches: 5,
statements: 5,
},
},
});