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

678
Vistas
Jest not running tests - Error while loading config - You appear to be using a native ECMAScript module configuration file

I'm having a problem configuring Jest to run my tests. When running npm test -- --watchAll --no-cache I get the message

babel.config.js: Error while loading config - You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously.

I've already checked other issues here on the OS, notably this one, but when I change the extension from babel.config to .cjs, the following message appears

Jest encountered an unexpected token

Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

By default "node_modules" folder is ignored by transformers.

Details:

SyntaxError: <project_root>/src/filmes/gerenciador.js: Unexpected reserved word 'await'. (13:24)

Below is my configuration files

package.json

{
    "name": "myfilms",
    "version": "1.0.0",
    "type": "module",
    "description": "",
    "main": "index.js",
    "scripts": {
        "test": "jest"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "@babel/core": "^7.15.0",
        "@babel/preset-env": "^7.15.0",
        "babel-jest": "^27.0.6",
        "jest": "^27.0.6",
        "json-server": "^0.16.3"
    },
    "dependencies": {
        "axios": "^0.21.1",
    }
}

babel.config.js

module.exports = {
    presets: [
        [
            "@babel/preset-env",
            {
                targets: {
                    node: "current",
                },
            },
        ],
    ],
};

Jest's and Babel's documentation is pretty confusing about these cases, and each of the solutions I try alternates between these two types of errors. Is there any standard way to configure Jest to support imports/exports and await/async?

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

0

I have the same problem right now, were you able to solve it?

almost 4 years ago · Carlos Pinda 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