Codeception / Codeception

Full-stack testing PHP framework
http://codeception.com
MIT License
4.77k stars 1.3k forks source link

PHPCov does not work with exported serialized format #6768

Closed codedge closed 3 months ago

codedge commented 3 months ago

I want to merge multiple coverage files generated by Codeception with the latest PHPCov version 10.

With Codeception I run

./vendor/bin/codecept run --coverage <some_test_file>

This generates a coverage.serialized file in tests/_output/. All good so far.

When running PHPCov

/usr/src/app # phpcov merge ../tests/_output/ --clover tests/_output/coverage-all.xml
phpcov 10.0.0 by Sebastian Bergmann.

No "/usr/src/tests/_output/*.cov" files found

although the coverage.serialized file is in it. Even when renaming the coverage.serialized file to *.cov, PHPCov picks it up but the generated report has only 0 in it.

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1720423602">
  <project timestamp="1720423602">
    <metrics files="0" loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
  </project>
</coverage>

I think that worked in the past but did change with some version update.

Details

namespace: App\Common\Tests

paths:
    tests: tests
    output: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
actor_suffix: Tester
extensions:
    enabled:
        - Codeception\Extension\RunFailed

coverage:
    enabled: true
    show_uncovered: true
    include:
        - src/*

Composer packages

/usr/src/app # composer show
behat/gherkin                      v4.9.0  Gherkin DSL parser for PHP
clue/ndjson-react                  v1.3.0  Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.
codeception/codeception            5.1.2   BDD-style testing framework
codeception/lib-asserts            2.1.0   Assertion methods used by Codeception core and Asserts module
codeception/module-asserts         3.0.0   Codeception module containing various assertions
codeception/stub                   4.1.3   Flexible Stub wrapper for PHPUnit's Mock Builder
composer/pcre                      3.1.4   PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                    3.4.0   Semver library that offers utilities, version constraint parsing and validation.
composer/xdebug-handler            3.0.5   Restarts a process without Xdebug.
elastic/ecs-logging                2.0.0   Format and enrich your log files in the elastic common schema
evenement/evenement                v3.0.2  Événement is a very simple event dispatching library for PHP
fidry/cpu-core-counter             1.1.0   Tiny utility to get the number of CPU cores.
friendsofphp/php-cs-fixer          v3.59.3 A tool to automatically fix PHP code style
monolog/monolog                    3.7.0   Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                  1.12.0  Create deep copies (clones) of your objects
nikic/php-parser                   v5.1.0  A PHP parser written in PHP
phar-io/manifest                   2.0.4   Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.2.1   Library for handling version information and constraints
phpstan/extension-installer        1.4.1   Composer plugin for automatic installation of PHPStan extensions
phpstan/phpstan                    1.11.6  PHPStan - PHP Static Analysis Tool
phpstan/phpstan-strict-rules       1.6.0   Extra strict and opinionated rules for PHPStan
phpstan/phpstan-symfony            1.4.5   Symfony Framework extensions and rules for PHPStan
phpunit/php-code-coverage          11.0.5  Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          5.0.1   FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                5.0.1   Invoke callables with a timeout
phpunit/php-text-template          4.0.1   Simple template engine.
phpunit/php-timer                  7.0.1   Utility class for timing
phpunit/phpunit                    11.2.6  The PHP Unit Testing framework.
psr/cache                          3.0.0   Common interface for caching libraries
psr/clock                          1.0.0   Common interface for reading the clock.
psr/container                      2.0.2   Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0   Standard interfaces for event handling.
psr/log                            3.0.0   Common interface for logging libraries
psy/psysh                          v0.12.4 An interactive shell for modern PHP.
react/cache                        v1.2.0  Async, Promise-based cache interface for ReactPHP
react/child-process                v0.6.5  Event-driven library for executing child processes with ReactPHP.
react/dns                          v1.13.0 Async DNS resolver for ReactPHP
react/event-loop                   v1.5.0  ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/promise                      v3.2.0  A lightweight implementation of CommonJS Promises/A for PHP
react/socket                       v1.15.0 Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP
react/stream                       v1.4.0  Event-driven readable and writable streams for non-blocking I/O in ReactPHP
sebastian/cli-parser               3.0.2   Library for parsing CLI options
sebastian/code-unit                3.0.1   Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 4.0.1   Looks up which function or method a line of code belongs to
sebastian/comparator               6.0.1   Provides the functionality to compare PHP values for equality
sebastian/complexity               4.0.1   Library for calculating the complexity of PHP code units
sebastian/diff                     6.0.2   Diff implementation
sebastian/environment              7.2.0   Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 6.1.3   Provides the functionality to export PHP variables for visualization
sebastian/global-state             7.0.2   Snapshotting of global state
sebastian/lines-of-code            3.0.1   Library for counting the lines of code in PHP source code
sebastian/object-enumerator        6.0.1   Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         4.0.1   Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        6.0.2   Provides functionality to recursively process PHP variables
sebastian/type                     5.0.1   Collection of value objects that represent the types of the PHP type system
sebastian/version                  5.0.1   Library that helps with managing the version number of Git-hosted PHP projects
symfony/cache                      v7.1.2  Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts            v3.5.0  Generic abstractions related to caching
symfony/clock                      v7.1.1  Decouples applications from the system clock
symfony/config                     v7.1.1  Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                    v7.1.2  Eases the creation of beautiful and testable command line interfaces
symfony/css-selector               v7.1.1  Converts CSS selectors to XPath expressions
symfony/dependency-injection       v7.1.2  Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts      v3.5.0  A generic function and convention to trigger deprecation notices
symfony/error-handler              v7.1.2  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v7.1.1  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.5.0  Generic abstractions related to dispatching event
symfony/filesystem                 v7.1.2  Provides basic utilities for the filesystem
symfony/finder                     v7.1.1  Finds files and directories via an intuitive fluent interface
symfony/framework-bundle           v7.0.9  Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client                v7.0.9  Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts      v3.5.0  Generic abstractions related to HTTP clients
symfony/http-foundation            v7.1.1  Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v7.1.2  Provides a structured process for converting a Request into a Response
symfony/monolog-bridge             v7.0.8  Provides integration for Monolog with various Symfony components
symfony/options-resolver           v7.1.1  Provides an improved replacement for the array_replace PHP function
symfony/password-hasher            v7.1.1  Provides password hashing utilities
symfony/polyfill-ctype             v1.30.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme     v1.30.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer   v1.30.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.30.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80             v1.30.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81             v1.30.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/polyfill-php83             v1.30.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
symfony/process                    v7.1.1  Executes commands in sub-processes
symfony/property-access            v7.1.1  Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info              v7.1.2  Extracts information about PHP class' properties using metadata of popular sources
symfony/routing                    v7.1.1  Maps an HTTP request to a set of configuration variables
symfony/security-bundle            v7.0.9  Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core              v7.1.2  Symfony Security Component - Core Library
symfony/security-csrf              v7.1.1  Symfony Security Component - CSRF Library
symfony/security-http              v7.1.2  Symfony Security Component - HTTP Integration
symfony/service-contracts          v3.5.0  Generic abstractions related to writing services
symfony/stopwatch                  v7.1.1  Provides a way to profile code
symfony/string                     v7.1.2  Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/type-info                  v7.1.1  Extracts PHP types information.
symfony/var-dumper                 v7.1.2  Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter               v7.1.2  Allows exporting any serializable PHP data structure to plain PHP code
symfony/yaml                       v7.1.1  Loads and dumps YAML files
theseer/tokenizer                  1.2.3   A small library for converting tokenized PHP source code into XML and potentially other formats
codedge commented 3 months ago

Renaming the coverage.serialized file to *.cov solves the issue with PHPCov. No idea how this worked before.