pglite-test
Postgres Tests Without a Server
A drop-in pgsql-test backed by an in-process PGlite instance. Instant, isolated Postgres databases with per-test rollbacks and pgpm-native seeding — no server, no Docker, no CI service container.
Zero Infrastructure
Pure WASM — no Postgres server, no Docker, no service container
Drop-in pgsql-test
Same getConnections() API; your tests read exactly the same
Per-test Rollback
Every test runs in its own transaction or savepoint
pglite-test Features
Run your whole Postgres test suite in-process
In-Process PGlite
One isolated instance per suite on ElectricSQL's WASM build of Postgres — no createdb, no psql, no TCP.
Ref-counted Rollbacks
The standard two-client beforeEach/afterEach harness emits exactly one BEGIN/SAVEPOINT/ROLLBACK per test on the shared session.
RLS-friendly
Role-based auth via setContext() with full GUC support; the standard app roles are bootstrapped for you by default.
pgpm-native Seeding
seed.pgpm() deploys your real database modules into PGlite with the unmodified pgpm engine.
WASM Extensions
Register pgvector, pg_trgm and friends at construction, then CREATE EXTENSION as usual.
Auto Teardown
In-memory by default: no residue, no reboots, just clean exits — ideal for GitHub Actions.
The Same Tests, No Server
The getConnections() API mirrors pgsql-test, so existing suites port by changing the import. Each suite gets its own in-process PGlite instance with automatic rollbacks.
WASM Extensions and Options
Register WASM extensions like pgvector at construction, keep data in memory or on disk, and seed with the unmodified pgpm engine.
Bring Your Own Roles
The standard app roles are created for you by default. Opt out for a clean superuser-only instance and define your own roles with real Postgres DDL.