We need to implement a -t watch like ts/bun.
Automatic hot reloading and unit testing are quite useful for frequently modifying and debugging code. I hope to expand this feature.
@phpmac Are you saying about the --watch option when run the tests?
./vendor/bin/pest --watch
./vendor/bin/pest path/file.php --watch
It's already exists.
--watch
no ,
INFO Unknown option "--watch".
name : pestphp/pest
descrip. : The elegant PHP Testing Framework.
keywords : framework, pest, php, test, testing, unit
versions : * v3.8.1
released : 2025-04-03, this week
type : library
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage :
source : [git] https://github.com/pestphp/pest.git 6080f51a0b0830715c48ba0e7458b06907febfe5
dist : [zip] https://api.github.com/repos/pestphp/pest/zipball/6080f51a0b0830715c48ba0e7458b06907febfe5 6080f51a0b0830715c48ba0e7458b06907febfe5
path : /Users/a/Downloads/laravel/vendor/pestphp/pest
names : pestphp/pest
support
issues : https://github.com/pestphp/pest/issues
source : https://github.com/pestphp/pest/tree/v3.8.1
autoload
files
psr-4
Pest\ => src/
requires
brianium/paratest ^7.8.3
nunomaduro/collision ^8.8.0
nunomaduro/termwind ^2.3.0
pestphp/pest-plugin ^3.0.0
pestphp/pest-plugin-arch ^3.1.0
pestphp/pest-plugin-mutate ^3.0.5
php ^8.2.0
phpunit/phpunit ^11.5.15
requires (dev)
pestphp/pest-dev-tools ^3.4.0
pestphp/pest-plugin-type-coverage ^3.5.0
symfony/process ^7.2.5
conflicts
filp/whoops <2.16.0
phpunit/phpunit >11.5.15
sebastian/exporter <6.0.0
webmozart/assert <1.11.0
@phpmac, it's a separate plugin (not part of core). https://pestphp.com/docs/plugins#watch
For reference, it depends on fswatch
Your answer surprised me.
@phpmac,它是一个单独的插件(不是核心的一部分)。 https://pestphp.com/docs/plugins#watch
作为参考,它取决于
fswatch
With the watcher, is it possible to use it so that it only re-runs relevant tests and not the whole suite.
@dimitriadamou, you should be able to use any additional flags such as --filter when using the Watch plugin as far as I know.
Unfortunately the Watch plugin is deprecated and archived. Version 3 of the Watch plugin is incompatible with Pest 4.
We need first-class support for a --watch flag in Pest. Anyone doing test-driven development does not want to switch to their terminal and run pest again manually after every code change. It's wild to me that this was removed.