One of my favourite software development tools is watchman-make. From its homepage:
watchman-makeis a convenience tool to help automatically invoke your build tool in response to files changing. It is useful to automate building assets or running tests as you save files during development.
In short: you change your files, and
watchman-make runs the command of your choice. I don’t like to switch away from my IDE as I code, so automatically re-running my test commands helps me stay productive and focused. It’s also extremely easy to configure.
Here are some examples of how I use
- Automatically run JS tests when a JS source file, test, or fixture template changes (aliased to
- Automatically sync CSS changes to my development server (aliased to
work syncis an inhouse sync command at Box)
- Run a designated phpunit test file when I change a PHP file (aliased to
watchman-make expects the commands it runs to have a target, eg
make install or
npm test; it errors if you just set a make parameter and no target parameter, eg
./run_all_my_tests. Fortunately you can bypass this by setting the target parameter to
'' (the empty string). (If you’re feeling motivated, I filed an issue about this on the project’s GitHub and the maintainers said they’d be amenable to a PR)
Installation instructions for
watchman-make are available on the project’s GitHub. Happy coding!