In jest watch mode, jest will only run test related to file changed since the last commit. So, if jest watch mode is not working, you should take a look at git
in your project.
The cause of issues can be vary. In my case it was something to do with git/index.lock': File exists
. index.lock
file can be created whenever you write code in the difference process then repository is locked for editing. I was working with difference ide (Intellij and VSCode) for the same project. Once index.lock
file created, you can not commit or push and throw an error below
You can simply solve this issue by deleting an index.lock
file like the error message indicated.
If you still can not solve this issue with this approach, it could possibly be related to git since jest watch mode run whenever git file changed like I mentioned earlier.