`herd coverage` still not working on Windows, and `herd debug` produces XDebug timeouts in console
@mpociot I'm happy to report that herd debug seems to work as expected after the update to v1.11.1 (aside from some xdebug timeouts in console). However, herd coverage still isn't working for me... At least it seems to not be loading the SQLite extension. Seems to not be loading the default .ini at all.
Here's some usage output to try to isolate the issue:
❯ herd php vendor/bin/pest --compact --bail
Tests: 2 passed (6 assertions)
Duration: 0.49s
❯ herd debug vendor/bin/pest --compact --bail
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Tests: 2 passed (6 assertions)
Duration: 1.08s
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
❯ herd coverage vendor/bin/pest --compact --bail
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
FAILED Tests\Feature\Actions\UpdateOrCreateProductTest > it can import a product QueryException
could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;)
at vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:66
62▕ */
63▕ protected function createPdoConnection($dsn, $username, $password, $options)
64▕ {
65▕ return version_compare(phpversion(), '8.4.0', '<')
➜ 66▕ ? new PDO($dsn, $username, $password, $options)
67▕ : PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */
68▕ }
69▕
70▕ /**
1 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:66
2 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:44
Tests: 1 failed, 1 pending (0 assertions)
Duration: 0.34s
Here's php --ini for all commands:
(Please note the leading double quote I mentioned previously on the path for herd coverage. It's not present for herd debug.)
❯ herd php --ini
Configuration File (php.ini) Path:
Loaded Configuration File: C:\Users\adeva\.config\herd\bin\php83\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
❯ herd debug --ini
Configuration File (php.ini) Path:
Loaded Configuration File: C:\Users\adeva\.config\herd\config\php\83\debug\debug.ini
Scan for additional .ini files in: C:\Users\adeva\.config\herd\bin\php83
Additional .ini files parsed: C:\Users\adeva\.config\herd\bin\php83\php.ini
❯ herd coverage --ini
Configuration File (php.ini) Path:
Loaded Configuration File: C:\Users\adeva\.config\herd\config\php\83\debug\debug.ini
Scan for additional .ini files in: "C:\Users\adeva\.config\herd\bin\php83
Additional .ini files parsed: (none)
Sidenote:
Both debug and coverage loads debug.ini as the main config, and then scans the additional folder for more files. Shouldn't all commands load the default .ini and the debug commands search for additional files?
Originally posted by @adevade in https://github.com/beyondcode/herd-community/issues/1007#issuecomment-2393153170
@adevade oh, there seems to be an additional double quote in the coverage command for the ini scan dir, which results in not correctly finding the php.ini file!
I fixed this in the next release.
In the meantime, you can manually apply a hotfix by changing line 95 in your herd.bat file from:
-set "PHP_INI_SCAN_DIR="!PHP_BIN_DIR!!PHP_VERSION_NUMBER!"
+set "PHP_INI_SCAN_DIR=!PHP_BIN_DIR!!PHP_VERSION_NUMBER!"
This should be done in this file:
C:\Program Files\herd\resources\app.asar.unpacked\resources\bin\herd.bat
This file will be copied to your .config folder when restarting Herd.
@mpociot Can confirm it seems to work with the manual fix! 👍
Any tips or ideas of how to fix the Xdebug: [Step Debug] Time-out connecting to debugging client console messages when using herd debug?
This is now fixed with Herd 1.11.2
The timeout issue you mention comes from using herd debug without an active xdebug listener (like phpstorm)