forked from baron/baron-sso
59 lines
1.8 KiB
TypeScript
59 lines
1.8 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()],
|
|
server: {
|
|
fs: {
|
|
allow: [
|
|
fileURLToPath(new URL(".", import.meta.url)),
|
|
fileURLToPath(new URL("../common", import.meta.url)),
|
|
],
|
|
},
|
|
},
|
|
test: {
|
|
globals: true,
|
|
environment: "jsdom",
|
|
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/main.tsx",
|
|
"src/vite-env.d.ts",
|
|
"../common/**/node_modules/**",
|
|
"../common/.pnpm-store/**",
|
|
`${commonRoot}/theme/**`,
|
|
`${commonRoot}/core/audit/index.ts`,
|
|
`${commonRoot}/core/components/audit/AuditLogTable.tsx`,
|
|
`${commonRoot}/core/components/overview/OverviewAxisNotes.tsx`,
|
|
`${commonRoot}/core/components/overview/OverviewMetric.tsx`,
|
|
`${commonRoot}/core/components/overview/OverviewSelectionChips.tsx`,
|
|
`${commonRoot}/core/components/page/PageHeader.tsx`,
|
|
`${commonRoot}/core/components/sort/SortableTableHead.tsx`,
|
|
`${commonRoot}/core/pagination/*.ts`,
|
|
`${commonRoot}/core/pagination/*.worker.ts`,
|
|
`${commonRoot}/core/query/queryClient.ts`,
|
|
],
|
|
},
|
|
},
|
|
});
|