A mock for PrismaClient that reads your Prisma schema and provides an in-memory store for fast, isolated unit tests.
Prismock is a mocking library for PrismaClient that reads your Prisma schema and provides an in-memory implementation for unit testing. It simulates Prisma's API to allow developers to write fast, isolated tests without needing a live database connection. The library is extensively tested against real Prisma results to ensure accuracy across MySQL, PostgreSQL, and MongoDB environments.
Developers using Prisma ORM who need to write unit tests for their applications without relying on a live database. It is particularly useful for backend engineers, full-stack developers, and educators teaching testing practices with Prisma.
Prismock offers a schema-aware, in-memory mock that closely replicates Prisma's behavior, enabling reliable and fast unit tests. Unlike generic mocks, it reads your actual Prisma schema, supports most Prisma features, and is validated against real database results, reducing test flakiness and integration complexity.
A mock for PrismaClient, dedicated to unit testing.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Reads your actual Prisma schema to generate models and relationships, ensuring the mock closely mirrors your database structure for reliable testing.
Supports most Prisma query methods, filters, and nested operations, with validation against real Prisma results across MySQL, PostgreSQL, and MongoDB.
Offers seamless setup with Jest and ViTest via automatic mocking or manual instantiation, fitting smoothly into existing testing workflows.
Stores data in-memory for rapid, isolated test runs without external database dependencies, ideal for CI/CD pipelines and retry-able tests.
Tested against real Prisma outcomes for multiple databases, increasing confidence in mock reliability and reducing test flakiness.
Lacks support for key Prisma features like JSON filters, scalar list methods, and some nested operations (e.g., set, disconnect), which can break tests for complex schemas.
Requires additional configuration via createPrismock for custom Prisma client output paths, adding overhead compared to standard setups.
GroupBy queries have limitations such as no skip, take, or cursor support, and referential actions like onUpdate are unsupported, restricting certain testing scenarios.
As a mock, it may not perfectly replicate all edge cases of real Prisma behavior, necessitating manual verification for critical or unsupported queries.