-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
47 lines (43 loc) · 1.02 KB
/
vite.config.ts
File metadata and controls
47 lines (43 loc) · 1.02 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
/// <reference types="vitest/config" />
import path from "path";
import react from "@vitejs/plugin-react";
import { defineConfig, loadEnv } from "vite";
import { configDefaults } from "vitest/config";
const getTestPatterns = (suites: string) => {
if (suites === "unit") {
return {
exclude: ["**/*.int.test.ts(x)?", "**/*.e2e.test.ts(x)?"],
};
}
if (suites === "int") {
return {
exclude: ["**/*.e2e.test.ts(x)?"],
};
}
return {
exclude: [],
};
};
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
resolve: {},
// TODO react module only config
test: {
globals: true,
environment: "jsdom",
setupFiles: path.resolve(__dirname, "./test-setup.ts"),
env: loadEnv(mode, process.cwd(), ""),
// TODO by env flags, for now just skip int tests
exclude: [
...configDefaults.exclude,
...getTestPatterns(env.VITEST_SUITES).exclude,
],
},
plugins: [react()],
define: {
"process.env": process.env,
},
};
});