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

176
Vistas
Globals from jest-preset are not available in tests

I'm trying to upgrade jest from v27 to v28. In my test files when I try to access GLOBAL_VARIABLE that is specified in jest-preset file I have this error

ReferenceError: GLOBAL_VARIABLE is not defined

package.json

"jest": "~28.0.0",
"ts-jest": "~28.0.0-next.3"

my jest-preset file looks like this

module.exports = {
    verbose: true,
    transform: {
        '^.+\\.(ts|tsx)$': 'ts-jest/legacy',
    testEnvironment: 'node',
    globals: {
        'ts-jest': {
            tsconfig: '<rootDir>/scripts/jest/tsconfig.json',
            isolatedModules: true,
        },
        GLOBAL_VARIABLE: true
    },
},

When running this with jest v27 it works as expected

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