pgtest

JSON →
library 0.2.3 ·javascript maintenance
verified Jun 5, 2026

pgtest is a drop-in replacement for node-postgres (pg) intended for unit testing. It allows you to mock database queries by specifying expected SQL strings or regular expressions, along with custom return data or errors. The current version is 0.2.3, and the library has seen no recent updates (last release appears years ago). It works with callbacks only, relying on rewire or similar tools to inject the mock into modules under test. Key differentiators: simple API, inline expectations without a separate query builder, and built-in verify/check to ensure all expectations were consumed. However, it does not support promises or async/await, and is not actively maintained, making it suitable only for legacy callback-based codebases.