Skip to content

Commit 1933edb

Browse files
committed
fix: separate test commands for coverage and non-coverage runs
- Add --no-coverage flag to default test command to avoid warnings - Create separate test:coverage command for CI/CD coverage generation - Remove failOnWarning from phpunit.xml.dist to prevent non-critical warnings from failing tests - Update GitHub Actions to use appropriate test command based on coverage needs - Fixes exit code 1 when running tests locally without xdebug/pcov installed
1 parent e97bbe4 commit 1933edb

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ jobs:
4141
- name: Install dependencies
4242
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4343

44-
- name: Execute tests
44+
- name: Execute tests (without coverage)
45+
if: matrix.php != '8.2' || matrix.stability != 'prefer-stable'
4546
run: composer test
4647

48+
- name: Execute tests (with coverage)
49+
if: matrix.php == '8.2' && matrix.stability == 'prefer-stable'
50+
run: composer test:coverage
51+
4752
- name: Upload coverage to Codecov
4853
if: matrix.php == '8.2' && matrix.stability == 'prefer-stable'
4954
uses: codecov/codecov-action@v3

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"symfony/var-dumper": "^6.2"
4545
},
4646
"scripts": {
47-
"test": "phpunit --testdox --coverage-text --coverage-clover=coverage.clover"
47+
"test": "phpunit --testdox --no-coverage",
48+
"test:coverage": "phpunit --testdox --coverage-text --coverage-clover=coverage.clover"
4849
},
4950
"minimum-stability": "stable",
5051
"prefer-stable": true,

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
processIsolation="false"
88
stopOnFailure="false"
99
executionOrder="random"
10-
failOnWarning="true"
1110
failOnRisky="true"
1211
failOnEmptyTestSuite="true"
1312
beStrictAboutOutputDuringTests="true"

0 commit comments

Comments
 (0)