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

351
Vistas
Jest is giving SyntaxError: Unexpected token '.'

I am trying to test my React componnent in which i have imported a css file like this

import styles from "./NavBar.module.css"

Jest Test suite fail to run

 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){.nav  {
                                                                                      ^
    SyntaxError: Unexpected token '.'

        import styles from "./NavBar.module.css";

It seems like jest does not understand css files. Is there a workaround?

my package.json

{
  "name": "client",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "test": "jest",
    "dev": "parcel watch index.html",
    "build": "npm install --include=dev && npm run build:parcel",
    "build:parcel": "parcel build index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/preset-env": "^7.17.10",
    "@babel/preset-react": "^7.16.7",
    "babel-jest": "^28.0.3",
    "buffer": "^6.0.3",
    "jest": "^28.0.3",
    "jest-babel": "^1.0.1",
    "jest-environment-jsdom": "^28.0.2",
    "parcel": "^2.5.0",
    "process": "^0.11.10"
  },
  "dependencies": {
    "axios": "^0.27.2",
    "firebase": "^9.7.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^6.2.2"
  },
  "babel": {
    "presets": [
      "@babel/preset-react",
      "@babel/preset-env"
    ]
  },
  "jest": {
    "testEnvironment": "jsdom"

  }
}

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