{"id":15450331,"url":"https://github.com/wackystudio/laravel-test-watcher","last_synced_at":"2025-04-19T22:58:27.132Z","repository":{"id":62545986,"uuid":"176163610","full_name":"WackyStudio/laravel-test-watcher","owner":"WackyStudio","description":"Laravel Test Watcher","archived":false,"fork":false,"pushed_at":"2020-09-29T07:14:19.000Z","size":441,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T20:17:47.784Z","etag":null,"topics":["laravel","laravel-package","phpunit","test-automation","test-driven-development","test-runner"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WackyStudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-17T21:34:56.000Z","updated_at":"2023-02-06T10:06:37.000Z","dependencies_parsed_at":"2022-11-02T22:15:37.424Z","dependency_job_id":null,"html_url":"https://github.com/WackyStudio/laravel-test-watcher","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WackyStudio%2Flaravel-test-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WackyStudio%2Flaravel-test-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WackyStudio%2Flaravel-test-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WackyStudio%2Flaravel-test-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WackyStudio","download_url":"https://codeload.github.com/WackyStudio/laravel-test-watcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249826664,"owners_count":21330673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-package","phpunit","test-automation","test-driven-development","test-runner"],"created_at":"2024-10-01T21:04:34.918Z","updated_at":"2025-04-19T22:58:27.109Z","avatar_url":"https://github.com/WackyStudio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](logo.jpg)\n# Run specific tests methods when your test or source code changes\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/wackystudio/laravel-test-watcher.svg?style=flat-square)](https://packagist.org/packages/wackystudio/laravel-test-watcher)\n[![Build Status](https://travis-ci.org/WackyStudio/laravel-test-watcher.svg?branch=master\u0026style=flat-square)](https://travis-ci.org/WackyStudio/laravel-test-watcher.svg?branch=master)\n[![Total Downloads](https://img.shields.io/packagist/dt/wackystudio/laravel-test-watcher.svg?style=flat-square)](https://packagist.org/packages/wackystudio/laravel-test-watcher)\n\nWhen looking at our testing workflow, we realized how often we were triggering our tests, especially single test cases or groups of test cases.\nUsing an IDE like PHPStorm this is done quickly with a keyboard shortcut, but in other IDEs, or editors, this is not always as easy. \nTherefore we have built Laravel Test Watcher.\n\nInstead of running your entire test suite or having to group your tests, Laravel Test Watcher can watch \ntest cases you annotate with a `@watch` annotation.\n\nYou start the watcher through the `tests:watch` artisan command. \nAs soon as you save a test file with a `@watch` annotation on a test case, \nLaravel Test Watcher automatically notice that you have added the annotation \nand run the test case for every change in your source code.\n\nWhen you are finished testing the test case, you can tell Laravel Test Watcher \nto stop watching the test case by removing the `@watch` annotation again; it is as easy as that.\n\nNo need to jump between your IDE/editor and the terminal, adding or removing `@watch` annotations in your code is enough, \nand Laravel Test Watcher takes care of the rest.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require wackystudio/laravel-test-watcher\n```\n\n## Usage\nTo watch a test in a test class, use the @watch annotation like this:\n``` php\n/**\n* @test\n* @watch\n*/\npublic function it_runs_annotated_tests_in_this_test_file()\n{\n    //...\n}\n```\nIf you are not using a `@test` annotation but are adding test to your test methods name, you can watch the test case like this:\n``` php\n/**\n* @watch\n*/\npublic function test_it_runs_annotated_tests_every_time_source_code_changes()\n{\n    //...\n}\n```\nTo watch tests and source file for changes, run the test watcher through Laravel Artisan like this:\n```bash\nphp artisan tests:watch\n```\n\n**NOTICE:**\nFor database testing we recommend that you create a `.env.testing` environment file with details for a dedicated testing database. \nIf you don't do this, Laravel Test Watcher will test against the database given in the `.env` file, which we do not recommend.\n\n### Configuration\nBy default Laravel Test Watcher watches all files in the `app` `routes` and `tests` folders, \nmeaning that any changes to a file in these directories, makes Laravel Test Watcher run all the watched test cases.\n\nIf you want to configure which directories Laravel Test Watcher should watch, you can do this by publishing the configuration file\nthrough the `vendor:publish` artisan command like this:\n```bash\nphp artisan vendor:publish\n```\npublish the configuration file for Laravel Test Watcher only or select the config tag to publish configuration files, for all packages in your Laravel Application.\n\n### Limitations\nEven though Laravel Test Watcher can watch as many tests as you like, \nit 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.\n\nSince 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. \n\nIf you need to run all your tests, we recommend you run a good old:\n```bash\n./vendor/bin/phpunit\n```\nThis will run through all of your tests in your test suite much faster.\n\nWhen starting Laravel Test Watcher through the artisan command, it bootstraps the entire Laravel application and loads the environment variables defined in the `.env` file. \nThis 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, \ninstead of the testing environment variables it should be using. \nTo mitigate this, Laravel Test Watcher requires a `.env.testing` file where all your environment variables for your testing setup is defined. \nThis is then used to override the environment variables when Laravel Test Watcher has been instantiated. \nUnfortunately, this means that you cannot use the environment variables you have defined in your `phpunit.xml` file.\n\n### Testing\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email tgn@wackystudio.com instead of using the issue tracker.\n\n## Credits\n\n- [Thomas Nørgaard](https://github.com/thomasnoergaard)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Laravel Package Boilerplate\n\nThis package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwackystudio%2Flaravel-test-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwackystudio%2Flaravel-test-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwackystudio%2Flaravel-test-watcher/lists"}