import { defineConfig } from 'vitest/config'; import path from 'path'; export default defineConfig({ test: { environment: 'node', globals: true, exclude: ['e2e/**', 'node_modules/**'], // Inline the workspace SVG-chart packages so Vitest transforms them and // resolves their `react` import through the dedupe below. Without this the // chart dist (linked from a sibling repo's pnpm store) loads a second // physical React copy and `renderToStaticMarkup` throws "Invalid hook call". // The real Next/webpack build already dedupes these to admin-web's React. server: { deps: { inline: [/@bytelyst\/(charts|data-viz|command-palette|dashboard-components|motion)/], }, }, coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], exclude: [ 'node_modules/**', '.next/**', 'coverage/**', '**/*.test.ts', '**/*.test.tsx', '**/*.config.*', '**/e2e/**', ], thresholds: { global: { branches: 80, functions: 80, lines: 80, statements: 80, }, }, }, }, resolve: { alias: { '@': path.resolve(__dirname, './src'), }, // Force a single physical React/React-DOM copy for SSR chart render tests. dedupe: ['react', 'react-dom'], }, });