Skip to content

Commit aaf9f62

Browse files
authored
Merge pull request #644 from pierresh/phpunit-watcher
test: re-run tests automatically with phpunit-watcher when a change is made
2 parents d6d3382 + 863282a commit aaf9f62

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
extensions: curl, mbstring
2121
tools: composer:v2
2222
- run: composer install
23-
- run: composer test
23+
- run: composer test-ci

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"phpstan/phpstan": "^2.1",
5252
"phpunit/phpunit": "^9.6",
5353
"rregeer/phpunit-coverage-check": "^0.3.1",
54+
"spatie/phpunit-watcher": "^1.23 || ^1.24",
5455
"squizlabs/php_codesniffer": "^3.11"
5556
},
5657
"config": {
@@ -61,7 +62,8 @@
6162
"sort-packages": true
6263
},
6364
"scripts": {
64-
"test": "phpunit",
65+
"test": "vendor/bin/phpunit-watcher watch",
66+
"test-ci": "phpunit",
6567
"test-coverage": "rm -f clover.xml && XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage --coverage-clover=clover.xml && vendor/bin/coverage-check clover.xml 100",
6668
"test-server": "echo \"Running Test Server\" && php -S localhost:8000 -t tests/server/",
6769
"test-server-v2": "echo \"Running Test Server\" && php -S localhost:8000 -t tests/server-v2/",

phpunit-watcher.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
hideManual: true
2+
watch:
3+
directories:
4+
- tests
5+
- flight
6+
fileMask: '*.php'
7+
notifications:
8+
passingTests: false
9+
failingTests: false
10+
phpunit:
11+
binaryPath: ./vendor/bin/phpunit
12+
arguments: '--stop-on-failure'
13+
timeout: 180

0 commit comments

Comments
 (0)