Skip to content
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

Add support for multiple whitelisted directories in CLI args #3797

Merged

Conversation

rask
Copy link
Contributor

@rask rask commented Aug 27, 2019

Previously inserting multiple --whitelist args would result in the
last one being the only effective one.

New implementation aggregates them and adds them to the code coverage
filtering one by one, allowing developers to use multiple directories
in whitelisting without relying on the XML configuration file.

This introduces no BC breaks, as the old behavior works in the same
way as always from the end user's perspective, internally an array
with a single item is used instead.

The way it can be used if this is merged:

phpunit --coverage-text --whitelist=mydir1 --whitelist=mydir2/file123.php --whitelist=mydir3/file1.php ./testsuite

Previously inserting multiple `--whitelist` args would result in the
last one being the only effective one.

New implementation aggregates them and adds them to the code coverage
filtering one by one, allowing developers to use multiple directories
in whitelisting without relying on the XML configuration file.

This introduces no BC breaks, as the old behavior works in the same
way as always from the end user's perspective, internally an array
with a single item is used instead.
@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label Aug 27, 2019
@sebastianbergmann sebastianbergmann added this to the PHPUnit 8.4 milestone Aug 27, 2019
@sebastianbergmann
Copy link
Owner

Out of curiosity: why can you not rely on the configuration file?

@rask
Copy link
Contributor Author

rask commented Aug 27, 2019

A monorepo with various projects relying on collective code, meaning developers often run only a subset of tests to save time, processing resources, and nerves. Coverage collection whitelisting cannot be committed into source control in out setup, and having to juggle the whitelist in the XML file during testing and development is tedious at times (and people accidentally commit their whitelist configuration to upstream). Having a CLI interface to define multiple whitelisted files/directories would simplify workloads and test runs a bit.

@sebastianbergmann
Copy link
Owner

Thank you for the explanation. I would probably address this with multiple XML configuration files but will, of course, consider this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants