Package name reuse (.prisma/client) when generating multiple prisma clients causes issues with some other libraries (e.g. jest) #4048
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
kind/bug
A reported bug.
tech/typescript
Issue for tech TypeScript.
topic: generator
Milestone
Bug description
prisma generate
with custom output settings creates clients all with the same package name ("./prisma/client"). It should use a unique name, such as the output path as the package name.This causes issues in some dependency management tools, such as jest-haste-map (used by jest@26.6.1), preventing jest from running in projects with more than one client.
This is a typical error you may get as a result of this:
How to reproduce
prisma init
, providing enough information forprisma generate
to run.prisma generate
generator client
in schema file, so that it includes an output directive (output: "../generated/database/client"
)prisma generate
<rootdir>/generated/database/client/package.json
is the same as<rootdir>/node_modules/.prisma/client/package.json
, and reads as follows:Optional: run
jest --clearCache
to see the impact of this.Expected behavior
The generated directory to have a package.json as follows (or similar):
Mitigations
testModuleIgnorePatterns
for jest).prisma generate
is calledPrisma information
Environment & setup
I expect this issue arises in all environments. Here is mine:
The text was updated successfully, but these errors were encountered: