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

Problem with whitelist and directories #31

Closed
kubawerlos opened this issue Sep 29, 2019 · 2 comments
Closed

Problem with whitelist and directories #31

kubawerlos opened this issue Sep 29, 2019 · 2 comments

Comments

@kubawerlos
Copy link
Contributor

kubawerlos commented Sep 29, 2019

I've created this repo (2 dummy classes, 100% code coverage expected).

Simple structure:

{
    "autoload-dev": {
        "psr-4": {
            "TheFoo\\": "./src",
            "TheFooDev\\": "./dev-code"
        }
    }
}

Whitelist:

    <filter>
        <whitelist>
            <directory>dev-code</directory>
            <directory>src</directory>
        </whitelist>
    </filter>

On master branch this build reports for xdebug and phpdbg 100% coverage (which is correct) and for pcov 50% (one class instead of two).

When I rename src to not-src then suddenly all is good - all 3 jobs reports 100% coverage.

When I rename dev-code to src-code then again, all is [good]https://travis-ci.com/kubawerlos/pcov-bug/builds/129603756) - all 3 jobs reports 100% coverage.

Can it be related to pcov.directory? But the 2nd rename shows that it is not directory, but directory prefix (as both src and src-code are considered).

@mtorromeo
Copy link

I've had this same issue and it is indeed related to pcov.directory.
The problem is described in the README under the NOTES section:

When pcov.directory is left unset, PCOV will attempt to find src, lib or, app in the current working directory, in that order; If none are found the current directory will be used, which may waste resources storing coverage information for the test suite.

So if you do not set pcov.directory and one of src, lib or app is found, no other directory is considered.

@kubawerlos
Copy link
Contributor Author

My conclusion after some checking is that pcov.directory is used as path prefix, not directory.

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

No branches or pull requests

2 participants