pgsql-test
Instant, Isolated Postgres Testing
Get instant, isolated Postgres 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 Postgres testing workflow
Instant Test Databases
Get fresh Postgres 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 pgpm 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 pgpm migrations for comprehensive test setup.