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

265
Views
¿Cómo habilitar globalmente immer mapSet para todas las pruebas de Jest?

Necesito ejecutar el siguiente código de configuración de la biblioteca en la inicialización de Jest:

 import { enableMapSet, enableES5 } from "immer"; enableMapSet(); enableES5();

Hago esto cuando inicializo mi aplicación CRA y mi libro de cuentos, pero ahora Jest también comenzó a fallar.

Intenté usar globalSetup así:

 // jest.config.js module.exports = { testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(test).[jt]s?(x)"], globalSetup: "./jest.setup.js", };
 // jest.setup.js import { enableMapSet, enableES5 } from "immer"; // <- also tried calling the setup fns on this very line, with no luck export default () => { enableMapSet(); enableES5(); };

pero fue en vano, sigo recibiendo el error:

 src/xxx/myTest.test.js ● Test suite failed to run [Immer] The plugin for 'MapSet' has not been loaded into Immer. To enable the plugin, import and call `enableMapSet()` when initializing your application. 8 | > 9 | export const immerFreeze = <T extends any>(x: T): T => produce(x, _noop); | ^

produce es la exportación predeterminada de "immer" , _noop es solo lodash noop.

¿Cuál es la forma correcta de ejecutar mi código de configuración? Odiaría tener que hacerlo en cada prueba individualmente.

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!