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

201
Vistas
Getting absolutely NO output from Jest when running tests

Here is my package.json:

"jest": {
   "cacheDirectory": "/tmp/jestCache",
   "scriptPreprocessor": "node_modules/babel-jest",
   "modulePaths": [
      "<rootDir>/app/static/react/"
   ],
   "moduleDirectories": [
      "node_modules",
      "app/static/react/app"
   ],
   "testPathDirs": [
      "app/static/react/__tests__"
   ],
   "testRegex": "(.*Tests?\\.jsx?)$"
}

When I run jest --verbose, the tests run, but there is no way to communicate anything to stdout as far as I can tell except by throwing an error. console.log itself does not exist. I am using jest 16.0.2. I've read that there are some recent changes around automocking and console buffering, but it seems like I'm missing something more fundamental.

The tests otherwise run fine.

Working on OSX Yosemite, node 7.4, npm 4.0.5.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I feel like you have too much configuration which is overwriting the defaults. One of the reasons that jest is awesome is that it works out of the box. First I would update to the latest version of jest 18.0.1 and babel-jest 17.0.2, and then I would try with the default configuration.

jest: {

},

Since you are using babel-jest you do not have to specify it in the config at all. Jest will just pick it up. Make sure you have a .babelrc in the same level as package.json though.

testPathDirs and testRegex default to ["<rootDir>"] and (/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$ so I think you do not need that too. Also moduleDirectories defaults to ["node_modules"] so you should be ok with this too.

Something else that I would definitely change is the path to your source. app/static/react/app seems a bit weird to me(I am not sure if jest gets confused because of react being inside your path). Something like app/static/src/ would make more sense. Also I would move the tests to app/static/src/__tests__/.

I know this answer might sound too generic but I would definitely start with not overriding the default config.

over 4 years ago · Santiago Trujillo 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