Jest TypeError: Path must be a string. Received undefined

In my case i had to update jest to version 21.x (from 20.x).

Try running npm install jest@latest --save-dev.


I solved this issue using:

  • npm uninstall -g jest
  • npm install -g jest
  • npm cache clean
  • npm install

I am not entirely sure what the problem here is, but I was facing the same issue and what worked for me was updating the Jest version. I was using 20 but I switched to 21 and now it magically works again.

Update version in package.json and then run rm -rf node_modules && npm install