Is coverage not available on docker container and aws ec2?
I installed pest from composer on a docker container.
And I ran ./vendor/bin/pest --coverage and got the error below.
What should i try next?
./vendor/bin/pest --coverage
PASS Tests\ExampleTest
โ it asserts true is true
Tests: 1 passed
Time: 0.05s
Pest\Exceptions\ShouldNotHappen
This should not happen - please create an new issue here: https://github.com/pestphp/pest.
- Issue: Coverage not found in path: /root/vendor/pestphp/.temp/coverage.php.
- PHP version: 7.4.3
- Operating system: Linux
at vendor/pestphp/pest/src/Exceptions/ShouldNotHappen.php:38
34โ * Creates a new instance of should not happen without a specific exception.
35โ */
36โ public static function fromMessage(string $message): ShouldNotHappen
37โ {
โ 38โ return new ShouldNotHappen(new Exception($message));
39โ }
40โ }
41โ
# php phpinfo.php
:
:
xdebug
xdebug support => enabled
Version => 2.9.2
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
:
:
root@6f9e66f2b2e5:~# nc -v 192.168.65.2 9000
Connection to 192.168.65.2 9000 port [tcp/*] succeeded!
root@6f9e66f2b2e5:~# nc -v 6f9e66f2b2e5 9000
Connection to 6f9e66f2b2e5 9000 port [tcp/*] succeeded!
root@6f9e66f2b2e5:~# nc -v host.docker.internal 9000
Connection to host.docker.internal 9000 port [tcp/*] succeeded!
[272] Log opened at 2020-09-07 09:35:49
[272] I: Connecting to configured address/port: host.docker.internal:9000.
[272] I: Connected to client. :-)
[272] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///root/vendor/pestphp/pest/bin/pest" language="PHP" xdebug:language_version="7.4.3" protocol_version="1.0" appid="272"><engine version="2.9.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
[272] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[272] Log closed at 2020-09-07 09:35:50
[273] Log opened at 2020-09-07 09:35:50
[273] I: Connecting to configured address/port: host.docker.internal:9000.
[273] I: Connected to client. :-)
[273] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///root/vendor/pestphp/pest/bin/pest" language="PHP" xdebug:language_version="7.4.3" protocol_version="1.0" appid="273"><engine version="2.9.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
{
"require-dev": {
"phpunit/phpunit": "9.2.6",
"pestphp/pest": "^0.2.4"
},
"minimum-stability": "dev",
"prefer-stable": true
}
# composer show
doctrine/instantiator 1.3.1 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
facade/ignition-contracts 1.0.1 Solution contracts for Ignition
filp/whoops 2.7.3 php error handling for cool kids
hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers
mockery/mockery 1.4.2 Mockery is a simple yet flexible PHP mock object framework
myclabs/deep-copy 1.10.1 Create deep copies (clones) of your objects
nunomaduro/collision v5.0.2 Cli error handling for console/command-line PHP applications.
pestphp/pest v0.2.4 An elegant PHP Testing Framework.
pestphp/pest-plugin v0.2.1 The Pest plugin manager
pestphp/pest-plugin-coverage v0.2.1 The Pest Coverage Plugin
pestphp/pest-plugin-init v0.2.3 The Pest Init plugin
phar-io/manifest 1.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version 2.0.1 Library for handling version information and constraints
phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock 5.2.1 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver 1.3.0 A PSR-5 based resolver of Class names, Types and Structural Element Names
phpspec/prophecy 1.11.1 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 8.0.2 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 3.0.4 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 3.1.0 Invoke callables with a timeout
phpunit/php-text-template 2.0.2 Simple template engine.
phpunit/php-timer 5.0.1 Utility class for timing
phpunit/php-token-stream 4.0.4 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 9.2.6 The PHP Unit Testing framework.
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/log 1.1.3 Common interface for logging libraries
sebastian/code-unit 1.0.5 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.2 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.3 Provides the functionality to compare PHP values for equality
sebastian/diff 4.0.2 Diff implementation
sebastian/environment 5.1.2 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.2 Provides the functionality to export PHP variables for visualization
sebastian/global-state 4.0.0 Snapshotting of global state
sebastian/object-enumerator 4.0.2 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 2.0.2 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 4.0.2 Provides functionality to recursively process PHP variables
sebastian/resource-operations 3.0.2 Provides a list of PHP built-in functions that operate on resources
sebastian/type 2.2.1 Collection of value objects that represent the types of the PHP type system
sebastian/version 3.0.1 Library that helps with managing the version number of Git-hosted PHP projects
symfony/console v5.1.5 Symfony Console Component
symfony/polyfill-ctype v1.18.1 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme v1.18.1 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer v1.18.1 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.18.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php73 v1.18.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80 v1.18.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/service-contracts v2.1.3 Generic abstractions related to writing services
symfony/string v5.1.5 Symfony String component
theseer/tokenizer 1.2.0 A small library for converting tokenized PHP source code into XML and potentially other formats
webmozart/assert 1.9.1 Assertions to validate method input/output with nice error messages.
if you need any further information to debug this or there is a critical error in what I'm doing please let me know. Thanks.
I self-solved.
I added a whitelist to phpunit.xml and it was done.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">php</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<directory suffix=".php">./src</directory>
โ <directory suffix=".php">./add/test/target/dir</directory>
</whitelist>
</filter>
</phpunit>
Would you consider changing the error message?
Regards
The default PHPUnit configurations that are generated by pest --init and artisan pest:install already cover the most common modern paths for including (src and app), but I think this might be something that would be good to add to the docs somewhere. Regarding adding additional coverage directories.
Most helpful comment
I self-solved.
I added a whitelist to phpunit.xml and it was done.
Would you consider changing the error message?
Regards