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

291
Vistas
Getting `SyntaxError: Cannot use import statement outside a module` when running Jest

I'm trying to run a test using Jest, and so I'm importing the following at the top of my test file:

import { describe, it, expect } from '@jest/globals'

However, when I run the test, I get the following error: SyntaxError: Cannot use import statement outside a module

How do I solve this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I figured out how to fix it. Instead, just use the CommonJS form of the statement at the top, as follows:

const { describe, it, expect } = require('@jest/globals')

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