There is also a less well utilized fsnotify feature for filesystem-wide notifications. Here is a cross-platform go implementation which also supports OSX: https://github.com/fsnotify/fsnotify
Hey! OP here. I submitted this exactly because I kept running into problems with inotify-tools, and other naive inotify wrappers, where tests would execute multiple times in quick succession, or stop executing on file changes, or other odd behavior.
Entr on the other hand works like a charm. You can see on the website that it details a number of edge cases with inotify that it works around. I'm not even sure it's an exhaustive list.
Note that that particular go implementation is prone to deadlocks.
Also, inotify is suboptimal for this use case. inotify has no recursion support, which means that the user must keep a watch on all files individually. There is also a limit to the number of inotify watches that can be in place at any one time.
A more modern, and more suitable interface for this use case is fanotify[0]. It doesn't provide all the functions that inotify does, but importantly it supports recursion, which alone would seem to make it a more obvious choice for this task.
inofity is no fantastic. Memory use scales with the number of directories watched. The program that uses the inotify system call has to keep a mapping of file descriptors to paths. Inotify is slow, inefficient and error-prone for recursively watching file systems.
fanotify is not an alternative because it cannot monitor file deletion or renames and it requires root permission.
https://linux.die.net/man/7/inotify
https://en.wikipedia.org/wiki/Inotify
There is also a less well utilized fsnotify feature for filesystem-wide notifications. Here is a cross-platform go implementation which also supports OSX: https://github.com/fsnotify/fsnotify