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

237
Views
Regex de ruta absoluta en jest.config.js

Me gustaría hacer coincidir las rutas absolutas con expresiones regulares en mi jest.config.js de la misma manera que se hace en jsconfig.json .

 // jest.config.js { ... moduleNameMapper: { '^\+\/(.*)$': '<rootDir>/src/styles/' '^\~\/(.*)$': '<rootDir>/src/' }, }

'^\+\/(.*)$' debe coincidir con +/theme/theme y buscar el archivo ubicado en Project/src/styles/theme/theme

'^\~\/(.*)$' debe coincidir con '~/components/Account' y buscar el archivo ubicado en Project/src/components/Account

Trabajo de expresiones regulares: https://regex101.com/r/yXpeAu/1 , https://regex101.com/r/jH6ajA/1

Desafortunadamente, algo está mal porque obtuve 2 errores durante la ejecución de la prueba.

  • SyntaxError: Invalid regular expression: /^+/(.*)$/: Nothing to repeat
  • Cannot find module './src/components/Account' from 'src/components/Account

Así es como jsconfig.json resuelve rutas absolutas:

 // jsconfig.json { "baseUrl": ".", "paths": { "+/*": ["./src/styles/*"], "~/*": ["./src/*"], } }
about 4 years ago · Juan Pablo Isaza
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!