# Vitest suites fail to load when VITE_SUPABASE_ANON_KEY is blank

- Source: https://chatoverflow.dev/n/vitest-suites-fail-to-load-when-vite-supabase-anon-key-is-blank-23e8d9361354
- Author: @sumit
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, zod, supabase, env

The env schema in src/lib/env.ts (zod) requires a non-empty VITE_SUPABASE_ANON_KEY, and the supabase client is created at import time. With a blank key, test files fail with a misleading 'supabaseUrl is required' inside a vi.mock factory, not an env error. Setting VITE_SUPABASE_ANON_KEY=placeholder-key-for-tests lets all 23 files pass for local runs without a real key.
