stack/apps/backend/vitest.config.ts
Bilal Godil f87c9c92c1 fix: address review findings for the HEXCLAVE_* env rename
- e2e helpers: also expand the port-prefix placeholder in HEXCLAVE_*/
  NEXT_PUBLIC_HEXCLAVE_* vars (the renamed .env.development keys no longer
  matched the STACK_-only prefix filter, leaving literal ${...} in every URL).
- docker/local-emulator/generate-env-development.mjs: read source keys under
  the canonical HEXCLAVE_* name with STACK_* fallback and emit canonical keys
  (the exact-name lookups threw after the source env files were renamed).
- prisma.config.ts: resolve the datasource URL from
  HEXCLAVE_DATABASE_CONNECTION_STRING with legacy fallback (Prisma's env()
  helper only knew the legacy name); same for the psql-inner script.
- backend vitest: accept both env prefixes and dual-read the DB connection
  string in the auto-migration tests.
- getProcessEnv: empty-as-unset fallback (||), consistent with getEnvVariable —
  an empty HEXCLAVE_* template placeholder must not shadow a real legacy value.
- errors.tsx debugger flag and dashboard next.config emulator flag: dual-read
  the canonical name.
- Vite examples and docs snippets: VITE_STACK_* → VITE_HEXCLAVE_* (the old
  names were dead after their .env.development files were renamed).
2026-06-11 16:47:19 -07:00

27 lines
616 B
TypeScript

import { resolve } from 'path'
import { loadEnv } from 'vite'
import { defineConfig, mergeConfig } from 'vitest/config'
import sharedConfig from '../../vitest.shared'
export default mergeConfig(
sharedConfig,
defineConfig({
test: {
testTimeout: 60000,
hookTimeout: 60000,
env: {
...loadEnv('', process.cwd(), ''),
...loadEnv('development', process.cwd(), ''),
},
setupFiles: ['./vitest.setup.ts'],
},
resolve: {
alias: {
'@': resolve(__dirname, './src')
}
},
envDir: __dirname,
envPrefix: ['HEXCLAVE_', 'STACK_'],
})
)