forked from baron/baron-sso
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { fileURLToPath } from "node:url";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
const commonRoot = fileURLToPath(new URL("../common", import.meta.url)).replace(
|
|
/\\/g,
|
|
"/",
|
|
);
|
|
const commonCoverageIncludes = ["core", "shell", "theme", "ui"].map(
|
|
(directory) => `${commonRoot}/${directory}/**/*.{ts,tsx}`,
|
|
);
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
esbuild: {
|
|
jsx: "automatic",
|
|
},
|
|
test: {
|
|
globals: true,
|
|
environment: "jsdom",
|
|
setupFiles: "./src/test/setup.ts",
|
|
include: ["src/**/*.{test,spec}.{ts,tsx}"],
|
|
coverage: {
|
|
provider: "v8",
|
|
reporter: ["text", "html", "lcov", "json-summary"],
|
|
reportsDirectory: "coverage",
|
|
all: true,
|
|
allowExternal: true,
|
|
include: ["src/**/*.{ts,tsx}", ...commonCoverageIncludes],
|
|
exclude: [
|
|
"**/*.{test,spec}.{ts,tsx}",
|
|
"**/*.d.ts",
|
|
"**/node_modules/**",
|
|
"**/dist/**",
|
|
"**/coverage/**",
|
|
"src/test/**",
|
|
"src/main.tsx",
|
|
"src/vite-env.d.ts",
|
|
"../common/**/node_modules/**",
|
|
"../common/.pnpm-store/**",
|
|
`${commonRoot}/theme/**`,
|
|
`${commonRoot}/core/pagination/*.worker.ts`,
|
|
`${commonRoot}/core/query/queryClient.ts`,
|
|
],
|
|
},
|
|
},
|
|
server: {
|
|
fs: {
|
|
allow: [".."],
|
|
},
|
|
},
|
|
});
|