How to automatically run PHPUnit tests with Laravel and Homestead

During my previous developments, I used to run a custom script with grunt-contrib-watch that reran my PHPUnit tests each time I saved a PHP file. However Laravel comes with Laravel Mix.

Laravel Mix logo

It is a useful tool, but it lacks (and will always lack) PHPUnit support. So I had to look for another solution and the savior was phpunit-watcher. Install, run and... code. That's it! It comes with useful features and customizations that you can tailor to your needs.

I ran these commands in my Homestead box:

$ composer global require spatie/phpunit-watcher

$ phpunit-watcher watch

phpunit-watcher in action



No comment yet.

A remark, a suggestion? Do not hesitate to express yourself below. Just be courteous and polite, please.

If this field is left blank, you will appear as Anonymous.