Download the PHP package spatie/phpunit-watcher without Composer
On this page you can find all versions of the php package spatie/phpunit-watcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spatie/phpunit-watcher
More information about spatie/phpunit-watcher
Files in spatie/phpunit-watcher
Package phpunit-watcher
Short Description Automatically rerun PHPUnit tests when source code changes
License MIT
Homepage https://github.com/spatie/phpunit-watcher
Informations about the package phpunit-watcher
Automatically rerun PHPUnit tests when source code changes
Wouldn't it be great if your PHPUnit tests would be automatically rerun whenever you change some code? This package can do exactly that.
With the package installed you can do this:
Here's how it looks like:
This will run the tests and rerun them whenever a file in the app
, src
or tests
directory is modified.
Want to pass some arguments to PHPUnit? No problem, just tack them on:
In his excellent talk at Laracon EU 2017 Amo Chohan shows our phpunit-watcher in action.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Installation
You can install this package globally like this
After that phpunit-watcher watch
can be run in any directory on your system.
Alternatively you can install the package locally as a dev dependency in your project
Locally installed you can run it with vendor/bin/phpunit-watcher watch
Usage
All the examples assume you've installed the package globally. If you opted for the local installation prepend vendor/bin/
everywhere where phpunit-watcher
is mentioned.
You can start the watcher with:
This will run the tests and rerun them whenever a file in the src
or tests
directory is modified.
Want to pass some arguments to PHPUnit? No problem, just tack them on:
Notes on interactive commands
When running phpunit-watcher
from a Composer script, you may need to redirect input in order for the interactive commands to work and disabled the default timeout:
On Windows, Currently, TTY is not being supported, so any interaction has been disabled. While watching for changes works,
any arguments for PHPUnit have to be provided when initially calling phpunit-watcher
.
Customization
Certain aspects of the behaviour of the tool can be modified. The file for options may be named .phpunit-watcher.yml
, phpunit-watcher.yml
or phpunit-watcher.yml.dist
. The tool will look for a file in that order.
If a config file does not exist in the project directory, the tool will check if a file exists in any of the parent directories of the project directory.
Here's some example content. Read on for a more detailed explanation of all the options.
Customize watched directories and files
You can customize the directories being watched by creating a file named .phpunit-watcher.yml
in your project directory. Here's some example content:
See the documentation for Finder for more details.
If you experience performance delays with large repositories, try adding exclude
entries for any large subdirectories that you don't need to watch. Enabling the ignore...
options can also be helpful. It's also important to ensure you're also using the '*.php'
file mask.
Desktop notifications
By default the tool will display desktop notifications whenever the tests pass or fail. If you want to disable certain desktop notifications update .phpunit-watcher.yml
by adding a notifications
key.
Help messages
By default the tool will display a helper for keyboard actions after each run. You can hide these help messages by adding a hideManual
key in the .phpunit-watcher.yml
.
Customize PHPUnit
Binary
By default the tool use vendor/bin/phpunit
as default PHPUnit binary file, however, it may be useful to be able to customize this value for people who have a binary file in a different location.
You can specificy it in the .phpunit-watcher.yml
config file. Here's an example:
Initial arguments
If you want to use pass the same arguments to PHPUnit everytime to watcher starts, you can specificy those in the .phpunit-watcher.yml
config file. Here's an example:
When starting the tool with some arguments (eg phpunit-watcher watch --filter=my_favourite_test
) those arguments will get used instead of the ones specified in the config file.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
Postcardware
You're free to use this package (it's MIT-licensed), but if you use it often we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.
We publish all received postcards on our company website.
Credits
- Freek Van der Herten
- All Contributors
We started creating this package after reading this excellent article by Christoper Pitt
Interactive commands were inspired by Jest.
License
The MIT License (MIT). Please see License File for more information.
All versions of phpunit-watcher with dependencies
clue/stdio-react Version ^2.6
jolicode/jolinotif Version ^2.7.1
symfony/console Version ^6 | ^7.0.7
symfony/finder Version ^6 | ^7.0.7
symfony/process Version ^6 | ^7.0.7
symfony/yaml Version ^6 | ^7.0.7