Giter Club home page Giter Club logo

Comments (17)

krakjoe avatar krakjoe commented on August 28, 2024 1

You seem to have a non-standard directory setup ...

php -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit tests

That's likely what you are looking for ...

from pcov.

kubawerlos avatar kubawerlos commented on August 28, 2024

What do you mean by "non-standard"? The src-dev directory? I have removed it and all references to it and still facing the issue. It was all fine a month ago -> https://coveralls.io/builds/23169688 (AFAIR it was PCOV v1.0.2 then).

However, your suggestion fixes it, thanks πŸ‘

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

from pcov.

kubawerlos avatar kubawerlos commented on August 28, 2024

Doesn't seems so - there are tests that covers lines that are problematic right now - e.g. https://github.com/kubawerlos/php-cs-fixer-custom-fixers/blob/master/tests/Fixer/InternalClassCasingFixerTest.php#L19 - and as I mentioned, when running only tests from subdirectory tests/Fixer all is covered fine.

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

You're quite right, something doesn't look right ... (I'm at my keyboard properly now, looking) ...

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

Can you please try the tip of develop (currently 1.1.0-dev) and patch vendor/phpunit/php-code-coverage/src/Driver/PCOV.php with this stop method:

    /**
     * Stop collection of code coverage information.
     */
    public function stop(): array
    {
        \pcov\stop();

        $waiting  = \pcov\waiting();
        $collect  = [];

        if ($waiting) {
            $collect = \pcov\collect(\pcov\inclusive, $waiting);

            if ($collect) {
                \pcov\clear(\pcov\coverage | \pcov\waiting);
            } else {
                \pcov\clear(\pcov\waiting);
            }
        }

        return $collect;
    }

I believe this produces correct results ?

from pcov.

kubawerlos avatar kubawerlos commented on August 28, 2024

Yes, it looks so, thanks for a help!

PR: https://github.com/kubawerlos/php-cs-fixer-custom-fixers/pull/98/files
Build: https://travis-ci.org/kubawerlos/php-cs-fixer-custom-fixers/jobs/540456641

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

I managed to go one better, you no longer need to patch the PHP driver, just update pcov ... 1.0.4-dev (managed to not break compat, so don't need to bump to 1.1) ...

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

Sorry about all the mess ...

from pcov.

kubawerlos avatar kubawerlos commented on August 28, 2024

Sorry about all the mess ...

No need to, thanks for the very quick fix πŸ‘

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

Very welcome.

from pcov.

deyvisonrocha avatar deyvisonrocha commented on August 28, 2024

@krakjoe Can you get folders to coverage from the phpunit.xml?

from pcov.

BHSPitMonkey avatar BHSPitMonkey commented on August 28, 2024

I think something is still off here, and possibly related to #31 and #38 (my experience lines up with all of these issues). I have a <filter><whitelist> defined in phpunit.xml with some <directory> nodes and an <exclude> node, and those get processed and sent to the pcov driver by phpunit via sebastianbergmann/php-code-coverage. After executing a simple test (using either phpunit or paratest), the resulting test reports show everything as uncovered (including specific lines I know were executed).

If I phpdismod pcov && phpenmod xdebug, my simple test works exactly as expected. Surely php-code-coverage is sending the filter/whitelist to pcov properly, since I can see the source files/methods/lines listed in the coverage report output -- but they're all marked 0%.

from pcov.

krakjoe avatar krakjoe commented on August 28, 2024

To clarify, php-code-coverage doesn't "send" or pass anything from phpunit configuration to pcov. pcov must be configured properly with pcov.directory.

from pcov.

BHSPitMonkey avatar BHSPitMonkey commented on August 28, 2024

from pcov.

miceno avatar miceno commented on August 28, 2024

@BHSPitMonkey I agree with you, I expend two days testing pcov with no coverage results due to this issue... I finally found the description here and figured it out to use -dpcov.directory.

from pcov.

trip-somers avatar trip-somers commented on August 28, 2024

Is it possible to run coverage on two folders? I basically have two /app folders -- one is legacy, and one is modern -- and it looks like the only alternative I have is to set directory to . and then exclude everything except those two folders. Is that really what I'd have to do?

EDIT: It looks like this works fine after just setting it to .. From there, it appears that the section of the phpunit.xml config is handling the rest of what I need.

from pcov.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.