End-to-end coverage for @supabase/server: real GoTrue-issued JWTs, real JWKS
validation over HTTP, real Supabase client operations — across all four
adapters (Hono, H3, Elysia, NestJS) plus the core withSupabase fetch
wrapper, the programming model Supabase Edge Functions use.
Unlike the unit/integration tests (mocked env, jwks: null), this suite:
- imports the library from
dist/, notsrc/, so packaging regressions fail here - reads config from
process.envviaresolveEnv()— no mocked env objects - verifies JWTs against the local stack's live JWKS endpoint — including
rejecting a forged token (real
kid, wrong signing key), so signature verification itself is exercised, not just structure checks - covers both context clients:
supabaseAdmin(app-layer scoping) and the user-scopedsupabaseclient, where the caller's JWT travels to PostgREST and a Postgres RLS policy scopes the rows - runs each adapter app on a real HTTP server and asserts over
fetch
pnpm build # e2e imports from dist/
cd e2e && supabase start # local stack (Docker) on ports 5433x
cd .. && pnpm gen:env # writes e2e/.env from `supabase status`
pnpm test:e2eRun a single adapter with pnpm test:e2e h3.
supabase/— local stack config +notestable migrationapps/<adapter>/app.ts— minimal app per adapter, identical route surface:GET /health(public),GET /me(user),GET /me-optional(user or none),GET|POST /notes(user, admin client scoped byuserClaims.id),GET /my-notes(user, RLS-scoped client — no WHERE clause),GET /all-notes(user, admin client with no filter — proves the admin client is not scoped to the caller)apps/core/app.ts— same surface on the corewithSupabase(config, handler)fetch wrapper (no adapter) — what an Edge Function deploys. A real Denosupabase functions servee2e is tracked as a follow-up issue.scenarios.ts— the single scenario set run against every adaptersetup/global-setup.ts— checks the stack is up, signs in two test users, provides their tokens to the testsscripts/gen-env.sh— writes.env(gitignored) from the running stackscripts/get-token.ts— prints a real user JWT for manual curl testing:TOKEN=$(node e2e/scripts/get-token.ts)(Node 22.18+)
Elysia is Bun-first, but its app.handle is a plain fetch handler, so the app
runs behind a node:http server (via srvx) and CI needs no Bun.