prospector/web/vitest.config.ts
Natalie 2512e7512c
Some checks are pending
CI / verify (push) Waiting to run
test(web): add vitest + RTL harness with 16-route mount coverage
jsdom + single-instance styled-components/react dedupe (mirrors vite) so the
ThemeProvider context reaches components; MemoryStorage shim for the theme's
localStorage persistence. App.test.tsx proves every prototype route resolves to a
real lazy-loaded view that mounts on the cocotte theme and renders content (not a
Suspense fallback, no Placeholder), with the data layer stubbed to a loading
state — queried by the semantic <main> region, not a class, since the shell is now
pure styled-components.

17 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 01:47:13 -04:00

19 lines
793 B
TypeScript

import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
// Test config for the PWA. jsdom + a single styled-components/React instance
// (same dedupe as vite.config) so the ThemeProvider context reaches components.
export default defineConfig({
plugins: [react()],
resolve: { dedupe: ['styled-components', 'react', 'react-dom'] },
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test/setup.ts'],
css: false,
// The @cocotte/@lilith design-system packages ship ESM with extensionless
// relative imports — Vite resolves them in the browser build, but vitest's
// node resolver doesn't. Inline them so Vite transforms them for the test.
server: { deps: { inline: [/@cocotte\//, /@lilith\//] } },
},
});