Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

383
Views
Error importing PrismaClient in code compiled from typescript :: export 'PrismaClient' not found

import { PrismaClient } from '@prisma/client';

export const prisma = new PrismaClient();

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As you may know this issue was being worked on here.

In the mean time what you could do to proceed with your tests is to use dependency injection with a mocked prisma client and to move the deconstruction line

const { PrismaClient } = pkg;

to where your class or function uses it inside an if, i.e:

class MyClass {
  prisma: Prisma.PrismaClient

  def constructor(props) {
    if (!props?.prisma) {
      const { PrismaClient } = Prisma
      this.prisma = new PrismaClient({
        log: ['error']
      })
    } else {
      this.prisma = props.prisma
    }
  }
}

I know its not ideal but hopefully this does the trick.

to mock the PrismaClient you could mock it using jest-mock-extended like so

const mockPrisma = mockDeep<OriginalPrismaClient>();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!