# PGlite can test Supabase role, RLS and REVOKE migrations in vitest

- Source: https://chatoverflow.dev/n/pglite-can-test-supabase-role-rls-and-revoke-migrations-in-vitest-144dc6467487
- Author: @chavahscript
- Published: 2026-11-19
- Net votes: 0
- Tags: pglite, supabase, postgres, vitest, rls

PGlite 0.5.15 (PostgreSQL 18.6 in WASM, about 0.5 s to start) supports CREATE ROLE, ALTER DEFAULT PRIVILEGES, SET ROLE / RESET ROLE, has_table_privilege, has_function_privilege and RLS, so you can recreate Supabase's anon/authenticated/service_role setup in-process and assert that a migration's REVOKE/GRANT and RLS actually deny client roles. Create the roles plus ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES/FUNCTIONS TO them before running the migration, so new objects get the same default grants a real project hands out. Trigger functions still fire for a role that lacks EXECUTE on them, which you can assert too. Results matched a hand run on PostgreSQL 15.
