siegebreak/services/vitest.integration.config.ts
caelum0x 80349345d1 feat: match-found screen, backend rate limiting + readiness, lifesteal
Web (web/): add a dedicated "Match Found" experience — when matchmaking
polling reports "matched", the Queue transitions to a MatchFound view
showing the Photon sessionId + deckId, an Enter Battle stub (no realtime
client yet), and Back to Menu that resets queue state. +3 tests (14 total).

Backend (services/): security + ops hardening.
- @fastify/rate-limit: env-driven global default plus stricter per-route
  limits on all /auth/* endpoints and POST /economy/purchase/validate,
  returning 429 { error: "rate_limited" } via the shared error handler.
- GET /ready readiness probe checking Postgres (SELECT 1) + Redis (ping),
  200 ready / 503 not_ready; GET /health stays as liveness.
- Env limits set high in both vitest configs so existing suites don't trip;
  dedicated test asserts the 429 boundary and both /ready outcomes.
  43 unit + 8 integration tests green.

Game (Assets/, Unity C#): add a lifesteal stat on CharacterConfig, wired
into Unit.ExecuteHit (heals attacker by damage*lifesteal via a new clamped
Health.Heal), and a new sustain-bruiser champion "Reaper". Unverified in
editor (no Unity toolchain available).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 18:29:12 +03:00

32 lines
1.3 KiB
TypeScript

import { defineConfig } from "vitest/config";
// Integration tests run against REAL Postgres + Redis (no mocks). They are kept
// in test-integration/ and excluded from the default `npm test` unit run, which
// mocks those dependencies. Requires a running DB/Redis — see docker-compose.yml
// or the DATABASE_URL/REDIS_URL below.
export default defineConfig({
test: {
environment: "node",
include: ["test-integration/**/*.test.ts"],
// A single DB is shared, so run serially to keep truncation deterministic.
fileParallelism: false,
sequence: { concurrent: false },
hookTimeout: 30_000,
testTimeout: 30_000,
env: {
NODE_ENV: "test",
JWT_SECRET: "integration-secret",
MATCH_SERVER_SECRET: "integration-server-secret",
// Keep the IP-keyed rate limiter effectively unlimited: the flows drive
// many /auth/* calls from one inject IP within a single window, which the
// default limits would otherwise trip.
RATE_LIMIT_MAX: "100000",
AUTH_RATE_LIMIT_MAX: "100000",
DATABASE_URL:
process.env.DATABASE_URL ?? "postgresql://postgres@localhost:5433/siegebreak_test",
// Dedicated Redis logical DB (15) so flushdb never touches other data.
REDIS_URL: process.env.REDIS_URL ?? "redis://localhost:6379/15",
},
},
});