Pgsql Test

Instant, Isolated PostgreSQL Testing

Get instant, isolated PostgreSQL databases for each test with automatic transaction rollbacks, context switching, and clean seeding. Write real SQL. Get real coverage. Stay fast.

Instant Test DBs

Each one seeded, isolated, and UUID-named

Per-test Rollback

Every test runs in its own transaction or savepoint

RLS-friendly

Test with role-based auth via setContext()

Pgsql Test Features

Optimize your PostgreSQL testing workflow

Instant Test Databases

Get fresh PostgreSQL databases for each test, seeded and isolated with UUID-based naming for zero conflicts.

Automatic Transaction Rollbacks

Every test runs in its own transaction or savepoint, ensuring complete isolation and automatic cleanup.

Row-Level Security Testing

Test with role-based authentication via setContext() to simulate real-world RLS scenarios.

Flexible Seeding System

Run .sql files, programmatic seeds, CSV/JSON fixtures, or even load Sqitch/LaunchQL migrations.

Test Framework Compatible

Works seamlessly with Jest, Mocha, and any async test runner for maximum flexibility.

Auto Teardown

No residue, no reboots, just clean exits with automatic cleanup of test databases.

Quick Setup with Automatic Rollbacks

Get started with pgsql-test in seconds. Each test gets its own isolated database with automatic transaction rollbacks, ensuring clean state between tests.

Role-Based Security Testing

Test Row-Level Security policies by simulating different user roles and JWT claims. Perfect for testing authentication and authorization logic.

Flexible Seeding Strategies

Compose multiple seeding strategies including SQL files, programmatic functions, CSV/JSON data, and LaunchQL migrations for comprehensive test setup.