Jest: Tests not running

Created on 5 Dec 2016  路  18Comments  路  Source: facebook/jest

I went through getting started but can't get jest to work. I use node v6.9.1, npm v3.10.8 and jest v17.0.3. I also tried --no-cache and --debug but nothing changes. I even moved test to __tests__ dir and renamed it accordingly.

Do you want to request a feature or report a bug?

  • bug

What is the current behavior?

  • no output, seems like no tests are being ran

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.

https://github.com/zigomir/jester

What is the expected behavior?

Test running and passing.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

Still nothing.

Needs More Info

Most helpful comment

I figured out jest won't run if i have watchman installed. As soon as I remove it with brew uninstall watchman it works.

I was able to find this out running node_modules/jest/bin/jest.js instead of npm test and iTerm2 printed out watchman in tab title :)

Can you please check if this is the case, I see https://github.com/facebook/watchman is Facebook's repo too ;)

All 18 comments

Hi @zigomir, this seems like an issue with npm. I've installed deps with yarn and tests are running. Try removing node_modules and run npm install once again.

If that not helps, could you please try installing your deps with other version of npm, e.g. using npm install -g npm@next. Or you can use yarn if that's not a problem.

I tried yarn myself before opening this issue. I didn't believe npm was that bad. So I ran yarn (v 0.18.0) now in my repo and jest (npm test, npm run tes, yarn run test) still won't run for me. I committed yarn.lock file to the repo mentioned above so you we can be sure to have same dependencies installed.

This is strange. I can still run tests, and they pass when fixing the error, using the same Node version, using either Yarn or npm. Which OS are you on? Have you tried on other machine?

Huh, this is strange. Running now on my VM (Debian) it runs, but not on my host, macOS v10.12.1 :/

I use the same macOS and it works, so this definitely has to be something with your environment. Maybe try to reinstall Node, remove node_modules? It sometimes does the trick ^^

Closing to manage the queue but happy to keep the discussion going and reopen if necessary.

I figured out jest won't run if i have watchman installed. As soon as I remove it with brew uninstall watchman it works.

I was able to find this out running node_modules/jest/bin/jest.js instead of npm test and iTerm2 printed out watchman in tab title :)

Can you please check if this is the case, I see https://github.com/facebook/watchman is Facebook's repo too ;)

I have watchman installed too (v4.5.0). Probably there was an issue with the version you've been using. Would be great if you installed newer version and try it once more :)

Of course I tried that first. It didn't help. I have a version v4.7.0 installed now and jest won't run.

Check out the bottom of this thread, might be related: https://github.com/facebook/jest/issues/1767

Thanks @cpojer! Yeah this is certainly related to my issue. So stopping watchman with launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist or brew uninstall watchman resolves issue for me. This works for me, glad to be able to use jest now :)

Another Mac OS user here that got bit by this issue, uninstalling watchman allows Jest to run tests.

Yet another watchman victim, thought for sure I messed up the babel and webpack configuration. Uninstall and all is well.

Yes, watchman was the culprit. Thanks!!

An easy solution to run the tests is with --no-watchman parameter. E.g.
yarn test --u --no-watchman

Another victim of watchman here :(

i have the same issue it work with yarn test --u --no-watchman

Upgrading to latest watchman (4.9) worked for me.

Was this page helpful?
0 / 5 - 0 ratings