Skip to content

support --coverage-filter flag #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ The following configuration options are available:
+ `group` Only runs tests from the specified group(s)
+ `exclude_group` Exclude tests from the specified group(s)
+ `test_suffix` Only search for test in files with specified suffix(es)
+ `whitelist` Path to directory to whitelist for code coverage analysis
+ `whitelist` Path to directory to whitelist for code coverage analysis (phpunit <= 8)
+ `coverage_filter` Include directory in code coverage reporting (phpunit >= 9)
+ `coverage_clover` Generate code coverage report in Clover XML format
+ `coverage_cobertura` Generate code coverage report in Cobertura XML format
required
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ inputs:
description: Path to directory to whitelist for code coverage analysis
required: false

coverage_filter:
description: Include directory in code coverage reporting
required: false

coverage_clover:
description: Generate code coverage report in Clover XML format
required: false
Expand Down Expand Up @@ -126,6 +130,7 @@ runs:
ACTION_TEST_SUFFIX: ${{ inputs.test_suffix }}
ACTION_WHITELIST: ${{ inputs.whitelist }}
ACTION_MEMORY_LIMIT: ${{ inputs.memory_limit }}
ACTION_COVERAGE_FILTER: ${{ inputs.coverage_filter }}
ACTION_COVERAGE_CLOVER: ${{ inputs.coverage_clover }}
ACTION_COVERAGE_COBERTURA: ${{ inputs.coverage_cobertura }}
ACTION_COVERAGE_CRAP4J: ${{ inputs.coverage_crap4j }}
Expand Down
6 changes: 6 additions & 0 deletions phpunit-action.bash
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ then
command_string+=(-d memory_limit="$ACTION_MEMORY_LIMIT")
fi

if [ -n "$ACTION_COVERAGE_FILTER" ]
then
command_string+=(--coverage-filter "$ACTION_COVERAGE_FILTER")
export XDEBUG_MODE=coverage
fi

if [ -n "$ACTION_COVERAGE_CLOVER" ]
then
command_string+=(--coverage-clover "$ACTION_COVERAGE_CLOVER")
Expand Down