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

129
Vistas
Find path to an imported element

I am mocking a component using jest.mock("../path/to/file").

If that mocked component moves around, Webstorm will fix all my imports. But it will not fix the path in the mock. I am trying to see if there is any way to solve this!

Something like...


import Component from "../../Component"

const pathToComponent = pathToFile(Component) // returns "../../Component", but this will change if the file moves.

Does such a function exist? Seems like it might be too meta...

(by the way, including the actual import to the component does not appear to break Jest's mocking)

about 4 years ago · Juan Pablo Isaza
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