- How do I install the Pest Plugin Watch package?
- Install it as a dev dependency with composer require --dev petecoop/pest-plugin-watch. Pest plugins are generally picked up automatically once the package is installed, though you can register it explicitly in your Pest.php if your setup requires it. Because it is a development tool, keep it out of production dependencies.
- Does Pest Plugin Watch work with Laravel applications?
- Yes. It is a Pest plugin, so it works in any project running Pest, including Laravel applications with Pest-based test suites. Laravel-specific behaviour such as database refreshes and factories is unchanged; the plugin only controls when the suite is re-executed.
- How do I enable watch mode in Pest?
- Run your tests with the --watch flag, for example pest --watch. The plugin keeps the process alive and re-runs the suite whenever a watched file changes. Stop it at any time with Ctrl+C.
- Can I choose which files or directories are watched?
- Yes. The plugin exposes configurable file paths so only relevant source and test files trigger a re-run. This keeps feedback fast in larger projects where unrelated assets change frequently. Configure the paths once and the watch loop respects them on every run.
- Which Pest versions does this plugin support?
- Compatibility depends on the Pest version required in the package's composer.json, so check the version constraints before installing. Run composer why petecoop/pest-plugin-watch after installation to confirm the resolved version. If you are on an older Pest release, pin the plugin version that matches your Pest major version.
- Should I use watch mode in CI pipelines?
- No. Watch mode is designed for local development, where a long-running process reacts to file edits. In CI you should run pest normally so the command exits with a status code that reflects the test results. A persistent watcher would hang the pipeline instead of finishing.
- Does watch mode slow down my test suite?
- No. The plugin does not change how tests execute; it simply re-runs your existing suite when files change. Any slowdown you notice will come from your tests themselves, not from the watcher. If runs feel slow, consider Pest parallel testing alongside watch mode.
- How is Pest Plugin Watch different from phpunit-watcher or IDE test runners?
- It integrates directly into Pest through a native --watch flag, so there is no separate binary or command to remember. Unlike an IDE runner, it works the same in any terminal and on any machine in your team. It is a focused, lightweight addition to your existing Pest workflow rather than a full test dashboard.
- Watch mode is not detecting my file changes, what should I check?
- First confirm the files you are editing are included in the configured watch paths. On virtualised or networked file systems, filesystem events can be unreliable, so try running the watcher from the host machine instead of inside the VM or container. Also check that the watch process is still running, since a fatal error ends the loop.
- Is petecoop/pest-plugin-watch actively maintained and safe for production use?
- It is a development-only tool, so it never ships in your production dependencies and does not affect runtime behaviour. As with any package, review the repository's recent commits and release history before adopting it. You can also pin an exact version in composer.json to keep your test tooling stable across installs.