Skip to content

launchql/supabase-test-suite

Repository files navigation

Supabase Test Suite

A friendly playground for building and validating Supabase Row-Level Security (RLS) using LaunchQL. It includes real-world examples, migrations, and a comprehensive test suite you can run locally.

Built with supabase-test — a Supabase-optimized version of pgsql-test for instant, isolated Postgres test databases with automatic rollbacks and Supabase defaults.

Features

  • 🔐 RLS Policy Testing - Real-world examples with users and products tables
  • 🧪 Comprehensive Test Suite - End-to-end tests against native Supabase schemas
  • 🐘 Zero-Setup Postgres - Supabase CLI local stack for instant development
  • Jest Integration - Fast, isolated tests with automatic rollbacks
  • 🚀 CI/CD Ready - GitHub Actions workflows for automated testing
  • 🧩 Modular Architecture - Reusable schema packages you can extend

Quick Start

# Initialize and start local Supabase stack
npx supabase init
npx supabase start

# Install dependencies
pnpm install

# Run tests in watch mode
cd packages/hello-world
pnpm test:watch

Repository Structure

This is a LaunchQL workspace combining pnpm and lql for modular Postgres packages:

  • packages/supabase - Supabase-focused SQL, tests, and helpers
  • packages/hello-world - Demo extension showcasing RLS with users/products

Testing

Run tests in different modes:

# Run all tests from root
pnpm test

# Watch mode for specific package
cd packages/hello-world
pnpm test:watch

# Run Supabase package tests
cd packages/supabase
pnpm test:watch

Requirements

  • Node.js 20+
  • pnpm 10+
  • Supabase CLI 2+

Troubleshooting

If you encounter connection issues, set your environment variables:

export PGPORT=54322
export PGHOST=localhost
export PGUSER=postgres
export PGPASSWORD=postgres

Common issues:

  • Ensure Supabase services are running (npx supabase status)
  • Check that ports match those shown by npx supabase start
  • Use Node.js 20+ to avoid compatibility issues

Related LaunchQL Tooling

  • launchql/pgsql-test: 📊 Isolated testing environments with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
  • launchql/supabase-test: 🧪 Supabase-native test harness preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

About

A friendly playground for building and validating Supabase Row‑Level Security (RLS) using LaunchQL

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •