Skip to content

test: add end-to-end tests against a local Supabase stack - #15

Open
ivasilov wants to merge 6 commits into
mainfrom
ivasilov/tanstack-db-e2e-tests
Open

test: add end-to-end tests against a local Supabase stack#15
ivasilov wants to merge 6 commits into
mainfrom
ivasilov/tanstack-db-e2e-tests

Conversation

@ivasilov

Copy link
Copy Markdown
Member

Adds an opt-in end-to-end suite that exercises the adapter against a real local Supabase (PostgREST + Realtime), booted through the vendored supabase CLI (added as a dev dependency). A Vitest projects split keeps pnpm test unit-only and Docker-free, while the new pnpm test:e2e self-boots only the containers the adapter needs (db, kong, rest, realtime, auth — everything else is disabled in supabase/config.toml), seeds data via the service-role admin client and a reset_e2e() RPC, then tears the stack down. The migration defines users/todos/users_todos with a realtime publication, REPLICA IDENTITY FULL, and RLS-enabled permissive policies (required for Realtime to broadcast), and the global setup warms up Realtime to avoid a cold-start race. The smoke test covers a PostgREST read, an insert, and a realtime event delivered from a second client. A CI workflow runs the unit checks and the e2e suite on Ubuntu runners.

🤖 Generated with Claude Code

ivasilov and others added 6 commits August 28, 2026 14:22
Add an opt-in e2e suite that runs the adapter against a real local
Supabase (PostgREST + Realtime), booted via the vendored `supabase`
CLI. A Vitest `projects` split keeps `pnpm test` unit-only and
Docker-free while `pnpm test:e2e` self-boots only the containers the
adapter needs (db, kong, rest, realtime, auth), seeds via the
service-role admin client, and tears the stack down afterwards. The
smoke test covers a PostgREST read, an insert, and a realtime event,
and a CI workflow runs both suites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e/delete

Add reads (WHERE pushdown + queryOnce), mutations (update/delete via
PostgREST), and realtime (update/delete from another client, the delete
exercising REPLICA IDENTITY FULL) tests. Extract the shared liveUsers
and WAIT helpers into e2e.utils so all e2e files reuse them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The delete payload carries the key via the default replica identity
(the collection key is the primary key), not REPLICA IDENTITY FULL.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace per-test collection/live-query/cleanup ceremony with lazy
test.extend fixtures whose teardown runs even when a test fails —
trailing cleanup calls previously leaked websockets on assertion
failure. Fold seeding into reset_e2e() (one RPC per test instead of
three round trips), warm realtime up against a dedicated e2e_warmup
table instead of sentinel rows in users, use createLiveQueryCollection
to drop the singleResult cast, read creds via inject() instead of
bridging through process.env, dissolve smoke.test.ts into the topic
files, and raise the e2e testTimeout so the innermost failing waiter
reports before the test times out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants