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

130
Views
La prueba de la unidad Jest se rompe debido a la importación

Entonces tengo un archivo con utils:

 import { someFunc, someOtherFunc } from 'someFile.js'; export const util1 = () => { return { abc: 1} }; export const util2 = (a, b) => { return someOtherFunc(a, b) + someFunc(a, b) };

Luego tengo otro archivo con pruebas:

 import { util1 } from 'utils.js'; describe('Whatever', () => { it('Does something', () => { const x = { a: 1 }; const y = util1(x); expect(y).toEqual({ abc: 1 }); }); });

Como puede ver, no estoy importando util2, pero cuando ejecuto jest, rompe el conjunto de pruebas. Esto se debe a someFunc, pero esa función no se usa aquí, así que no sé cómo ignorarla...

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

0

  1. Instalar
 npm install --save-dev @babel/plugin-transform-modules-commonjs
  1. Crear .babelrc con
 { "env": { "test": { "plugins": ["@babel/plugin-transform-modules-commonjs"] } } }
  1. Si aún no funciona, intente poner "type": "module" en su paquete.json
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!