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

Feature Request: Ignore @covers option #571

Open
BackEndTea opened this issue Dec 12, 2017 · 4 comments
Open

Feature Request: Ignore @covers option #571

BackEndTea opened this issue Dec 12, 2017 · 4 comments

Comments

@BackEndTea
Copy link

Although the use of @covers and @coversNothing is really useful for generating good coverage reports, there are also times when we want to ignore those settings. For example, i may wish to see exactly what my integration tests are covering.

My proposal would be to add a command line flag to phpunit, for example --ignore-covers or something like that. Which would cause @covers and @coversNothing to be ignored when calculating the code coverage.

Slightly related to: infection/infection#88 (comment)

@fkupper
Copy link

fkupper commented Feb 13, 2018

Just came up to the exact same need.

@danon
Copy link

danon commented Jul 4, 2022

I would like to have this option as well, to enable/disable the @covers dynamically, depending on needs.

@danon
Copy link

danon commented Jul 9, 2022

You can install tool rawr/covers-ignore, which will remove @covers and @coversNothing annotations from a test suite, which you can then run in phpunit.

Here's an example of usage in Github Actions: https://github.com/T-Regx/T-Regx/blob/master/.github/workflows/build.yaml#L70

@BrianHenryIE
Copy link

BrianHenryIE commented Feb 9, 2023

I've written a script to match the changed lines in a git diff with the covered lines in code coverage output, and run the tests that cover the changed lines.

I use @covers everywhere, so unfortunately I'm only getting the tests that are written to test specifically those changed lines. It would be more effective if I could output a second codecoverage report which ignores the @covers annotations and gives me the true picture of every test that tested each line.

I'll try #573

My script: BrianHenryIE/php-diff-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants