petecoop / pest-plugin-watch
A Pest plugin to watch your files and re-run tests on changes.
Installs: 3
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/petecoop/pest-plugin-watch
Requires
- php: ^8.3
- pestphp/pest: ^4.0.0
- pestphp/pest-plugin: ^4.0.0
- spatie/file-system-watcher: ^1.2
README
A Pest plugin to watch files and restart Pest when they change.
This is a Pest Watch plugin that works with Pest v4 and differs from the official Pest Watch plugin which became unsupported. It's now built on the spatie/file-system-watcher package which uses the node package chokidar under the hood for efficient file watching.
Installation
You can install the package via composer:
composer require petecoop/pest-plugin-watch --dev
In your project, you should have the JavaScript package chokidar installed. You can install it via npm
npm install chokidar --save-dev
If you are using Bun, you can install it via:
bun a -d chokidar
The watcher will automatically use Bun if there is a bun.lock file in your project.
Usage
To start Pest in watch mode, run the following command:
pest --watch
This will restart Pest whenever a file in src, app or tests changes.
You can override the default paths by providing your own paths, for example inside your Pest.php file:
Petecoop\PestWatch\Plugin::directories(['src', 'tests', 'custom-dir']);