Watch Plugin


The Watch plugin keeps an eye on your application and automatically runs your Pest tests when you change files inside specific directories.

Note: This is still a development package and needs further testing.


First, install fswatch on your machine, or check if you already have it:

1fswatch --version

Then, install the Watch Plugin via the Composer package manager:

1composer require pestphp/pest-plugin-watch --dev

Once the installation is finished, your Pest CLI will have a new --watch option available.

Running Watch

Running pest --watch starts Pest in watch mode and, from this point on, any file modification inside the directories will trigger Pest to run your tests.

1pest --watch # Night gathers, and now my watch begins

Default directories

By default, the Watch plugin observes the following directories:

  • tests/
  • app/
  • src/

Custom directories

If you need to watch a custom set of directories, just provide a comma-separated list to the --watch flag.


1pest --watch=app,routes,tests

The command will watch the app, routes, and tests directories.

Next section: Creating Plugins →