fix(test): add test env defaults to root vitest config — fixes 35 pre-existing failures

Root vitest.config.ts now sets:
- DB_PROVIDER=memory — datastore uses MemoryDatastoreProvider (no Cosmos needed)
- RATE_LIMIT_STORE_MODE=memory — ratelimit store uses in-memory sliding window
- COSMOS_ENDPOINT, COSMOS_KEY, JWT_SECRET — test-safe placeholders so config.ts
  Zod parse succeeds (never used at runtime with DB_PROVIDER=memory)

This fixes 35 pre-existing test failures across 6 files when running from root:
- ratelimit.test.ts (15 tests) — was hitting Cosmos path
- diagnostics.test.ts (4 tests) — was hitting Cosmos path
- auto-register.test.ts (8 tests) — config parse failed
- onboarding.test.ts (1 test) — config parse failed
- telemetry.test.ts (suite) — config parse failed via event-bus import chain
- cross-product.test.ts (6 tests) — config parse failed

Platform-service: 117/117 files, 1389/1389 tests (was 1251 passing)
This commit is contained in:
saravanakumardb1 2026-03-21 12:06:34 -07:00
parent 32afe8dde7
commit 0b16cb4d63

View File

@ -5,6 +5,13 @@ export default defineConfig({
globals: true,
environment: 'node',
passWithNoTests: true,
env: {
DB_PROVIDER: 'memory',
RATE_LIMIT_STORE_MODE: 'memory',
COSMOS_ENDPOINT: 'https://test.documents.azure.com:443/',
COSMOS_KEY: 'dGVzdC1rZXktZm9yLXZpdGVzdC1vbmx5',
JWT_SECRET: 'vitest-only-not-for-production',
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],