Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda