forked from SandeepVashishtha/Eventra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.js
More file actions
41 lines (39 loc) · 1.14 KB
/
Copy pathvitest.config.js
File metadata and controls
41 lines (39 loc) · 1.14 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
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import path from "path";
import { transformWithOxc } from "vite";
const JSX_HINT_RE = /<[A-Za-z][A-Za-z0-9.]*[\s\n\r/>]|<>/;
export default defineConfig({
plugins: [
{
name: "jsx-in-js",
enforce: "pre",
async transform(code, id) {
if (!/[/\\]src[/\\].*\.js$/.test(id)) return null;
if (!JSX_HINT_RE.test(code)) return null;
return transformWithOxc(code, id, { lang: "jsx" });
},
},
react({
include: /\.(jsx|tsx)$/,
}),
],
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/setupTests.js"],
include: ["src/**/*.test.{js,jsx,ts,tsx}"],
exclude: ["src/**/*.spec.{js,jsx}", "tests/**"],
css: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"@components": path.resolve(__dirname, "src/components"),
"@pages": path.resolve(__dirname, "src/Pages"),
"@hooks": path.resolve(__dirname, "src/hooks"),
"@utils": path.resolve(__dirname, "src/utils"),
"@context": path.resolve(__dirname, "src/context"),
},
},
});