Vitest environment for Prisma & PostgreSQL designed for fast integration tests: seed your database once with production-like data, then run each test in a transaction that is rolled back after execution. Tests remain isolated without expensive reseeding. Current version 1.0.1 requires Prisma 7.x and Vitest 4.x. Provides a custom test environment, setup hooks, and typed configuration. Key differentiator: transaction-rollback isolation without database-level overhead, unlike alternatives that reseed per test.
npm install vitest-environment-prisma-postgresNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configuration and setup for Vitest integration tests using prisma-postgres environment, including client path, setup files, and mocking.
Upgrade Node.js to version 24 or later.
Always specify clientPath in environmentOptions.
Avoid manual transaction calls in tests; rely on the environment's automatic rollback.
Add 'vitest-environment-prisma-postgres/setup' as the first entry in setupFiles.
Ensure the package is installed: npm install vitest-environment-prisma-postgres --save-dev
Set globals: true in vitest config or import vi from 'vitest'.
Add environment: 'prisma-postgres' to your vitest config under test.