PHPackages                             wackystudio/laravel-test-watcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. wackystudio/laravel-test-watcher

ActiveLibrary[Testing &amp; Quality](/categories/testing)

wackystudio/laravel-test-watcher
================================

A test file watcher for Laravel that automatically runs specific test cases based on a @watch annotation

1.0.14(5y ago)2219.7k—0%4[1 issues](https://github.com/WackyStudio/laravel-test-watcher/issues)MITPHPPHP ^7.2|^7.3|^7.4CI failing

Since Apr 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/WackyStudio/laravel-test-watcher)[ Packagist](https://packagist.org/packages/wackystudio/laravel-test-watcher)[ Docs](https://github.com/wackystudio/laravel-test-watcher)[ RSS](/packages/wackystudio-laravel-test-watcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (16)Used By (0)

[![Logo](logo.jpg)](logo.jpg)

Run specific tests methods when your test or source code changes
================================================================

[](#run-specific-tests-methods-when-your-test-or-source-code-changes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/be575b6af5474c3040444a591d04856b6b3dce74e4f67278cc7561e96b8e0de0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7761636b7973747564696f2f6c61726176656c2d746573742d776174636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wackystudio/laravel-test-watcher)[![Build Status](https://camo.githubusercontent.com/e388e35aab949b0c1691114b66ef2c8a4fdc2cc77892035243b9acd9670c9086/68747470733a2f2f7472617669732d63692e6f72672f5761636b7953747564696f2f6c61726176656c2d746573742d776174636865722e7376673f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://travis-ci.org/WackyStudio/laravel-test-watcher.svg?branch=master)[![Total Downloads](https://camo.githubusercontent.com/3dbb82d4bc3b302db0959e4ad90fec223d7bd821866753faf963e2e1e11ddf92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7761636b7973747564696f2f6c61726176656c2d746573742d776174636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wackystudio/laravel-test-watcher)

When looking at our testing workflow, we realized how often we were triggering our tests, especially single test cases or groups of test cases. Using an IDE like PHPStorm this is done quickly with a keyboard shortcut, but in other IDEs, or editors, this is not always as easy. Therefore we have built Laravel Test Watcher.

Instead of running your entire test suite or having to group your tests, Laravel Test Watcher can watch test cases you annotate with a `@watch` annotation.

You start the watcher through the `tests:watch` artisan command. As soon as you save a test file with a `@watch` annotation on a test case, Laravel Test Watcher automatically notice that you have added the annotation and run the test case for every change in your source code.

When you are finished testing the test case, you can tell Laravel Test Watcher to stop watching the test case by removing the `@watch` annotation again; it is as easy as that.

No need to jump between your IDE/editor and the terminal, adding or removing `@watch` annotations in your code is enough, and Laravel Test Watcher takes care of the rest.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require wackystudio/laravel-test-watcher
```

Usage
-----

[](#usage)

To watch a test in a test class, use the @watch annotation like this:

```
/**
* @test
* @watch
*/
public function it_runs_annotated_tests_in_this_test_file()
{
    //...
}
```

If you are not using a `@test` annotation but are adding test to your test methods name, you can watch the test case like this:

```
/**
* @watch
*/
public function test_it_runs_annotated_tests_every_time_source_code_changes()
{
    //...
}
```

To watch tests and source file for changes, run the test watcher through Laravel Artisan like this:

```
php artisan tests:watch
```

**NOTICE:**For database testing we recommend that you create a `.env.testing` environment file with details for a dedicated testing database. If you don't do this, Laravel Test Watcher will test against the database given in the `.env` file, which we do not recommend.

### Configuration

[](#configuration)

By default Laravel Test Watcher watches all files in the `app` `routes` and `tests` folders, meaning that any changes to a file in these directories, makes Laravel Test Watcher run all the watched test cases.

If you want to configure which directories Laravel Test Watcher should watch, you can do this by publishing the configuration file through the `vendor:publish` artisan command like this:

```
php artisan vendor:publish
```

publish the configuration file for Laravel Test Watcher only or select the config tag to publish configuration files, for all packages in your Laravel Application.

### Limitations

[](#limitations)

Even though Laravel Test Watcher can watch as many tests as you like, it is not the intention that you should use it on every single test case in your test suite but instead, use it on the tests for the current feature you are implementing.

Since it is not possible to tell PHPUnit to run multiple single test cases so all test cases can be tested in a single PHPUnit session, each test case is running in its own PHPUnit session, which makes the execution of the tests a bit slower.

If you need to run all your tests, we recommend you run a good old:

```
./vendor/bin/phpunit
```

This will run through all of your tests in your test suite much faster.

When starting Laravel Test Watcher through the artisan command, it bootstraps the entire Laravel application and loads the environment variables defined in the `.env` file. This gives us some issues since PHPUnit does not override the loaded environment variables when running tests which make each test run with the environment variables already loaded, instead of the testing environment variables it should be using. To mitigate this, Laravel Test Watcher requires a `.env.testing` file where all your environment variables for your testing setup is defined. This is then used to override the environment variables when Laravel Test Watcher has been instantiated. Unfortunately, this means that you cannot use the environment variables you have defined in your `phpunit.xml` file.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Thomas Nørgaard](https://github.com/thomasnoergaard)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 94.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~73 days

Total

15

Last Release

2049d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.0.1PHP ^7.2

1.0.14PHP ^7.2|^7.3|^7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/1278f475f7ca14e74a2a11ef85ca3fdef01bde50e7b3b7923ac2288e1545683b?d=identicon)[wackystudio](/maintainers/wackystudio)

---

Top Contributors

[![ThomasNoergaard](https://avatars.githubusercontent.com/u/13256296?v=4)](https://github.com/ThomasNoergaard "ThomasNoergaard (55 commits)")[![dennisoderwald](https://avatars.githubusercontent.com/u/1653185?v=4)](https://github.com/dennisoderwald "dennisoderwald (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laravellaravel-packagephpunittest-automationtest-driven-developmenttest-runnerwackystudiolaravel-test-watcher

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wackystudio-laravel-test-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/wackystudio-laravel-test-watcher/health.svg)](https://phpackages.com/packages/wackystudio-laravel-test-watcher)
```

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M256](/packages/laravel-dusk)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
