Files
vngeoguessr/vitest.integration.config.mjs
T
tiennm99 6569f095c9 feat(game): serve panorama index from Neon Postgres
- panoramas + pano_provinces tables replace 28MB bundled JSON; pano-index.js
  now draws via cached COUNT + ORDER BY id OFFSET with rejection sampling,
  composite (province,id)/(district,id) indexes support the skip
- scripts/seed-pano-db.mjs validates pipeline artifacts (the old real-data
  vitest invariants, extracted to scripts/lib/pano-artifacts.mjs), stages
  into panoramas_next, verifies, renames into place in one transaction,
  keeps panoramas_old as backup; --province reseeds in place; --check
  validates only
- pipeline writes gitignored data-build/panos/; pano barrel removed
- tests run against PGlite mocked in at the @neondatabase/serverless
  boundary, mirroring the fake-upstash pattern; fixtures replace real data
- infrastructure errors rethrow instead of reading as missing coverage;
  session ids via crypto.randomUUID (uuid package dropped)
2026-08-31 09:44:03 +07:00

29 lines
1.1 KiB
JavaScript

import { defineConfig } from 'vitest/config';
// Runs the same suite as vitest.config.mjs, but against the local SRH container
// instead of the in-memory fake, so real Redis answers every command. Start the
// stack first: `npm run redis:up`.
export default defineConfig({
test: {
environment: 'node',
include: ['tests/**/*.test.js'],
globalSetup: ['tests/wait-for-srh.js'],
// Real network round-trips, and the overflow tests issue a few hundred of
// them, so the default timeout is too tight.
testTimeout: 30_000,
// One file at a time: they all share a single Redis and each flushes the
// keyspace between tests.
fileParallelism: false,
env: {
TEST_REDIS: 'real',
UPSTASH_REDIS_REST_URL: 'http://localhost:8079',
// Matches SRH_TOKEN in docker-compose.yml.
UPSTASH_REDIS_REST_TOKEN: 'vngeoguessr-local-token',
KEY_PREFIX: 'vngeoguessr:',
// Only Redis has a real integration lane; the Neon SDK stays mocked with
// PGlite here too, so the handle guard needs a value, not a service.
DATABASE_URL: 'postgres://fake-neon.test/fake',
},
},
});