A testing utility library for Prisma (formerly Prisma 2) that generates seed data and database pool management based on your Prisma schema. Version 0.4.1 (latest) is the current stable release, with sparse updates since 2020. The project is temporarily unmaintained as noted in the README. Key features include automatic seed data generation with customizable factories, isolated per-test databases via connection pooling, and full TypeScript type safety. Differentiates from manual seeding by being data-model agnostic and automatically adapting to schema changes. Requires peer dependencies @prisma/client, @prisma/lift, and prisma2, though these are now outdated as Prisma has evolved significantly (Prisma 4+).
npm install prisma-test-utilsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures the generator, seeds 10 Post records with faker-generated titles, and queries them using the Prisma client.
Consider using prisma/seed or custom seed scripts with Prisma 4+. Also explore alternatives like jest-prisma or prisma-seed.
Use Prisma 2.x (prisma2) for compatibility. Cannot be used with Prisma 3+ without modifications.
Ensure generator output path matches your import path exactly. Use tsconfig paths or jest moduleNameMapper as needed.
Type the bag parameter explicitly: (bag: any) => ({...}) or use generated types if available.Use transaction rollback or isolated Prisma datamodels per test instead of database pooling.
Run 'prisma generate' after adding generator testutils to schema.prisma. Verify output path matches your imports.
Use default import: import seed from '@generated/prisma-test-utils/seed'
Install all peer deps: npm install @prisma/client @prisma/lift prisma2