mirror of
https://github.com/vernu/textbee.git
synced 2026-07-30 17:07:46 -04:00
Establish the testing safety net for the web dashboard before refactoring. - Vitest + React Testing Library + jsdom for unit/component tests - MSW node server mocks the API; unhandled requests throw so tests can never reach a real backend - Playwright e2e boots the real Next app but intercepts every /api/v1 call with shared fixtures, and mints a NextAuth session cookie to run authed - Shared fixtures in test/fixtures.ts back both layers - Seed tests: Button unit tests, MSW sanity checks, and a dashboard e2e happy path plus an auth-guard redirect Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
882 B
TypeScript
29 lines
882 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'node:path'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
// Mirror the tsconfig "@/*" -> "./*" path alias.
|
|
alias: { '@': path.resolve(__dirname, './') },
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./test/setup.ts'],
|
|
// Unit/component tests only. Playwright specs live in ./e2e and run separately.
|
|
include: ['**/*.{test,spec}.{ts,tsx}'],
|
|
exclude: ['node_modules', '.next', 'e2e', 'test-results', 'playwright-report'],
|
|
env: {
|
|
NEXT_PUBLIC_API_BASE_URL: 'http://localhost:3001/api/v1',
|
|
},
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html'],
|
|
include: ['app/**', 'components/**', 'lib/**', 'hooks/**'],
|
|
exclude: ['**/*.d.ts', 'test/**', 'e2e/**'],
|
|
},
|
|
},
|
|
})
|