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

Trigger warning when code coverage analysis is performed and no cache directory is configured #6150

Closed
sebastianbergmann opened this issue Mar 16, 2025 · 6 comments
Assignees
Labels
feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/test-runner CLI test runner type/enhancement A new idea that should be implemented
Milestone

Comments

@sebastianbergmann
Copy link
Owner

No description provided.

@sebastianbergmann sebastianbergmann added feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/test-runner CLI test runner type/enhancement A new idea that should be implemented labels Mar 16, 2025
@sebastianbergmann sebastianbergmann self-assigned this Mar 16, 2025
@sebastianbergmann sebastianbergmann added this to the PHPUnit 12.1 milestone Mar 16, 2025
@Zolletta
Copy link

So you are meaning that cache is mandatory for code coverage analysis?

Thank you

@chamithmalindalsc
Copy link

We got this issue in our pipelines suddenly 2 days back. Had to update the cache directory to get this working and it's wired.

     `cacheDirectory=".phpunit.cache"`

following is the warning. But this was not there 2,3 days back - strange

WARN No cache directory configured, result of static analysis for code coverage will not be cached

@spawnia
Copy link

spawnia commented Mar 20, 2025

I have had a couple CI pipelines fail as a result of this change. Perhaps this warning is a bit overzealous?

My solution attempt at a solution was to set failOnWarning="false" in my PHPUnit XML configuration, e.g.

<?xml version="1.0"?>
<phpunit failOnWarning="false"

Configuring cacheDirectory, as described in #6150 (comment) did the trick. However, I feel that this adds a line of boilerplate that I did not necessarily need before to every project.

Why do I need to change my configuration now when it used to work fine before? What is the proper resolution for this?

spawnia added a commit to mll-lab/laravel-utils that referenced this issue Mar 20, 2025
spawnia added a commit to nuwave/lighthouse that referenced this issue Mar 20, 2025
@Zolletta
Copy link

@sebastianbergmann I see now that the trigger is a phpunit 12.1 milestone. But I am currently using version 11. Maybe you can raise the trigger warning only if the version is 12 or (12.1) or above?

@sebastianbergmann
Copy link
Owner Author

Those two changes are unrelated. I have reverted the warning in PHPUnit 11.5 and PHPUnit 12.0.

@mvorisek
Copy link
Contributor

mvorisek commented Mar 23, 2025

+1 for reverting the warning as pointed out in 6565fa7#r154096373

landed/reverted in 82c0b24

Please never require explicit cache directory. Implicit system cache directory should be used instead when accessible. The reason is we want to keep our configs minimal as possible.

@sebastianbergmann would you mind to tag a new releases with the revert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/test-runner CLI test runner type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

5 participants