0

I try to run php artisan test --coverage (laravel unit testing) but i get 2 errors

 WARN  No filter is configured, code coverage will not be processed

and 2

 WARN  Unable to get coverage using Xdebug. Did you set Xdebug's coverage mode?

I dont get it i have php8.1 and 8.2 and in both the fpm and the cli php.ini i have

xdebug.mode=coverage,debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003

If i do php -v i get

PHP 8.2.14 (cli) (built: Dec 21 2023 20:18:00) (NTS)
   Copyright (c) The PHP Group
   Zend Engine v4.2.14, Copyright (c) Zend Technologies
with Zend OPcache v8.2.14, Copyright (c), by Zend Technologies
with Xdebug v3.3.0, Copyright (c) 2002-2023, by Derick Rethans

I do not see what the problem is.

3
  • Welcome, what do you get when running php -i | grep 'xdebug\.mode'? Commented Dec 31, 2023 at 17:48
  • i get: "Enabled Features (through 'xdebug.mode' setting) xdebug.mode => coverage => coverage" Commented Dec 31, 2023 at 18:18
  • In PhpStorm xdebug works just fine Commented Dec 31, 2023 at 19:29

1 Answer 1

0

So the second error is misleading, the first the solution

It whas a case of rtfm i should add to phpunit.xml

<source>
    <include>
        <directory suffix=".php">./app</directory>
    </include>
</source>

representing the files i want to be checked in the report. This fixes both errors.

Detailed info: click here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.