Kumar Gaurav About

Running tests on file change

Run tests (or any other command) on file changes

I use fswatch to watch files and run commands when the file changes.


$ brew update && brew install fswatch


I use it to run a single command while watching the current directory

$ fswatch -o . | xargs -n1 -I{} go test -v

So, in general

$ fswatch -o /path/to/watched/files | xargs -n1 -I{} <command>