/** * Vitest 配置 —— 仅跑 MAF 模块的真实挂载测试(jsdom + Testing Library)。 * * 设计: * - environment=jsdom 让 React 组件可挂载; * - 只 include `*.test.tsx`(组件挂载测试),现有 `*.test.ts`(node:test 纯函数) * 保持原来的 esbuild + node --test 路径,互不干扰; * - 复用项目 tsconfig 的 `@/*` → `./src/*` 别名; * - 不引入 CDN / 在线服务,所有依赖本地安装并锁入 lockfile。 */ import path from "node:path"; import { fileURLToPath } from "node:url"; import { defineConfig } from "vitest/config"; import react from "@vitejs/plugin-react"; const here = path.dirname(fileURLToPath(import.meta.url)); export default defineConfig({ plugins: [react()], resolve: { alias: { "@": path.resolve(here, "src"), }, }, test: { environment: "jsdom", globals: true, // 只跑 MAF 的组件挂载测试(.test.tsx);纯函数 .test.ts 仍走 esbuild+node --test include: ["src/maf-roundtable/**/*.test.tsx"], exclude: ["**/node_modules/**", "**/dist/**"], }, });