Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

388
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda