"--watch is not supported without git/hg" with cygwin jest and git
I would really appreciate help with this.
I have cygwin installed and set up to use the PATH from windows. This has been working great for a ton of node development, but I've recently run into an issue where when I run
yarn jest --watch
I get the following error:
--watch is not supported without git/hg, please use --watchAll error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have installed git and node in windows.
I have found a workaround of using the Command Prompt for running the tests, but would really like to be in one environment.
After some consideration, I thought my workaround could be a valid answer to this question. Although, I would still like to get this working properly in Cygwin.
If you have node and git installed in windows then you can go into the Command Prompt and run
yarn test --watch or
npm run test -- --watch to accomplish the same thing.
I also encountered this problem, the reason is that I use the mv command to move the project folder, however the command was not removed .git has points such as the beginning of the file
--watch works only for git repositories.
if you still have issue it is yarn issue npm gives the same error too. delete your node_modules folder, update yarn or npm to the latest version, then reinstall all the packages again.
npm run test -- watchAll
Please use watchAll to serve it in a continue way. It will track your changes and re-run the test automatically.
- Yeah, it was/is definitely a Git repository. And the version of Git was actually higher at the time than the version of Git in my Windows environment. I think it just something more to do with NPM from Windows into the cygwin environment. Permissions or something similar are probably blocking it from running properly.
- did u try to reinstall the node_modules
- Yeah, what you suggested was the very first thing I tried as it has fixed the problems when working on dual booted mac+win systems or NFS systems.
- I don't recall now, but I was met with the same issue or watchAll was undesirable.