I use the entrcommand for this kind of task. It receives a list of files and runs the given command when one of the files changes.
Example:
find src test -name "*.php" -type f | entr phpunit
The good thing about entris that it is a language and an agnostic command, I can use it for phpunit, JavaScript unit test, linting, etc. Also, compared to watchrme, I only need to set one instead of ruby runtime.
source
share