Files
opengroupware/vitest.config.ts
Ken Yasue 21b9f03e9d feat(m3): auth & user management with session, tests, and e2e
- Custom error classes (lib/errors.ts) and signed-cookie session
  (lib/auth/session.ts, HMAC-SHA256, httpOnly+sameSite=lax)
- UserRepository + AuthService (bcrypt hashing, role/status checks,
  register/login/logout/getCurrentUser/updateProfile)
- Auth helpers (getCurrentUser), user validator, API error handler
- API routes: register (auto-login), login, logout, me, PATCH users/me,
  GET admin/migrations (admin-only guard)
- middleware.ts redirects unauthenticated page access to /login
- Screens: login (login/register toggle), profile, dashboard skeleton,
  home redirect
- vitest: exclude e2e specs, setupFiles for SESSION_SECRET
- playwright: run migrate before dev server, set SESSION_SECRET
- Unit tests (UserRepository, AuthService, session), integration
  auth-flow, e2e auth.spec (register/login/logout/protected/401)
2026-06-25 00:36:42 +02:00

48 lines
1009 B
TypeScript

import { defineConfig } from 'vitest/config';
import path from 'node:path';
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: [
'tests/**/*.{test,spec}.{ts,tsx}',
'lib/**/*.{test,spec}.{ts,tsx}',
'repositories/**/*.{test,spec}.{ts,tsx}',
'services/**/*.{test,spec}.{ts,tsx}',
],
exclude: [
'tests/e2e/**',
'node_modules/**',
'dist/**',
'.next/**',
'**/node_modules/**',
],
setupFiles: ['tests/setup.ts'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/**',
'dist/**',
'.next/**',
'.steering/**',
'**/*.config.{ts,js,mjs}',
'**/types/**',
'tests/**',
],
thresholds: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
},
},
});