riseup-squad18/vitest.config.ts
Fernando Pirichowski Aguiar 389a191f20 fix: corrige persistência de avatar, agendamento de consulta e download de PDF
- Avatar do paciente agora persiste após reload (adiciona timestamp para evitar cache)
- Agendamento usa patient_id correto ao invés de user_id
- Botão de download de PDF desbloqueado com logs detalhados
2025-11-15 08:36:41 -03:00

52 lines
1.8 KiB
TypeScript

import { defineConfig } from "vitest/config";
import path from "path";
export default defineConfig({
// Keep test transform simple; plugin-react SWC already handled in Vite dev build, not needed here
resolve: {
// Ensure a single React instance to avoid invalid hook calls
dedupe: ["react", "react-dom"],
alias: {
react: path.resolve(__dirname, "node_modules/react"),
"react-dom": path.resolve(__dirname, "node_modules/react-dom"),
"react/jsx-runtime": path.resolve(
__dirname,
"node_modules/react/jsx-runtime.js"
),
"react/jsx-dev-runtime": path.resolve(
__dirname,
"node_modules/react/jsx-dev-runtime.js"
),
"react-dom/client": path.resolve(
__dirname,
"node_modules/react-dom/client"
),
// Avoid cosmiconfig trying to parse package.json via custom loaders during tests (affects puppeteer)
cosmiconfig: path.resolve(__dirname, "src/tests/shims/cosmiconfig.ts"),
},
},
esbuild: {
jsx: "automatic",
},
// No Vite plugins required for Vitest; avoids type/version mismatches
test: {
// Temporário: usar happy-dom para contornar falha de render no jsdom enquanto ambiente React é estabilizado
environment: "happy-dom",
globals: true,
setupFiles: ["./vitest.setup.ts"],
exclude: [
"**/node_modules/**",
"**/dist/**",
"**/.{idea,git,cache,output,temp}/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
// Temporarily exclude axe test due to jsdom/lru-cache compatibility issue
"**/__tests__/accessibilityMenu.axe.test.tsx",
],
coverage: {
provider: "v8",
reportsDirectory: "./coverage",
reporter: ["text", "html"],
},
},
});