-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
34 lines (32 loc) · 952 Bytes
/
Copy pathvitest.config.ts
File metadata and controls
34 lines (32 loc) · 952 Bytes
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
import react from "@vitejs/plugin-react";
import { defineConfig, type Plugin } from "vitest/config";
import { fileURLToPath } from "node:url";
/**
* Load GLSL shader files as raw string default exports, mirroring the
* Next/Turbopack `raw-loader` rule in next.config.ts so engine code that
* imports `.vert`/`.frag` sources can be exercised under vitest.
*/
function rawGlsl(): Plugin {
return {
name: "raw-glsl",
transform(code, id) {
if (!/\.(vert|frag|glsl)$/.test(id)) return null;
return { code: `export default ${JSON.stringify(code)};`, map: null };
},
};
}
export default defineConfig({
plugins: [rawGlsl(), react()],
test: {
environment: "jsdom",
globals: true,
setupFiles: ["./vitest.setup.ts"],
include: ["**/*.test.{ts,tsx}"],
exclude: ["node_modules", ".next", ".npm-cache"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./", import.meta.url)),
},
},
});