Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: herd coverage not working on Windows #1007

Closed
adevade opened this issue Sep 19, 2024 · 16 comments
Closed

[Bug]: herd coverage not working on Windows #1007

adevade opened this issue Sep 19, 2024 · 16 comments

Comments

@adevade
Copy link

adevade commented Sep 19, 2024

Platform

Windows

Operating system version

Windows 11 Home (23H2 22631.4169)

System architecture

Windows

Herd Version

1.10.0 PRO

PHP Version

PHP 8.3.11

Bug description

I'm trying to run pest to test my application, and wanted to try out coverage and the new mutation testing, but I can't get it working with Herd.

Running herd coverage vendor/bin/pest seems to fail the loading of the SQLite driver. It works as expected if I run herd php vendor/bin/pest...

Am I doing anything obviously wrong? Please let me know what more information I can provide to help with troubleshooting.


PS: I noticed that if I right click and select "Open php.ini directory" in Herd, it opens to an empty folder (sometimes) containing another empty folder called "debug".

Steps to reproduce

No response

Relevant log output

herd php vendor/bin/pest --bail

  PASS  Tests\Feature\Actions\UpdateOrCreateProductTest
  ✓ it can import a product
  ✓ it can update an existing product

  Tests: 2 passed

-------------------------

herd debug vendor/bin/pest --bail

  PASS  Tests\Feature\Actions\UpdateOrCreateProductTest
  ✓ it can import a product
  ✓ it can update an existing product

  Tests: 2 passed

-------------------------

herd coverage vendor/bin/pest --bail

   FAIL  Tests\Feature\Actions\UpdateOrCreateProductTest
  ⨯ it can import a product
  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   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
@issuelabeler issuelabeler bot added the windows label Sep 19, 2024
@adevade
Copy link
Author

adevade commented Sep 19, 2024

Here's some more info from running the different commands:

❯ herd php -v                                                     
PHP 8.3.11 (cli) (built: Aug 27 2024 21:28:35) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.11, Copyright (c), by Zend Technologies

❯ herd debug -v
PHP 8.3.11 (cli) (built: Aug 27 2024 21:28:35) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.11, Copyright (c), by Zend Technologies

❯ herd coverage -v
PHP 8.3.11 (cli) (built: Aug 27 2024 21:28:35) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.11, Copyright (c) Zend Technologies

@mpociot
Copy link
Member

mpociot commented Sep 19, 2024

herd debug and herd coverage load an additional debug.ini file
You can see this when you're running php --ini

This file automatically gets populated when you have Herd Pro.

Can you verify that this file exists for you?

You should see a difference between php --ini and herd coverage --ini

@adevade
Copy link
Author

adevade commented Sep 19, 2024

@mpociot Here's the output for all commands:

❯ herd php --ini    
Configuration File (php.ini) Path: 
Loaded Configuration File:         C:\Users\adevade\.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:         (none)
Scan for additional .ini files in: C:\Users\adevade\.config\herd\bin\php83
Additional .ini files parsed:      C:\Users\adevade\.config\herd\bin\php83\php.ini

❯ herd coverage --ini
Configuration File (php.ini) Path: 
Loaded Configuration File:         (none)
Scan for additional .ini files in: "C:\Users\adevade\.config\herd\bin\php83
Additional .ini files parsed:      (none)

I see a leading double quote on the herd coverage command, but no closing one. The output above is directly from the terminal.


EDIT: There does not exist a file called debug.ini in C:\Users\adevade\.config\herd\bin\php83


EDIT 2: There's no files in C:\Users\adevade\.config\herd\config\php\83\debug either.

@mpociot
Copy link
Member

mpociot commented Sep 19, 2024

@adevade Do you see "Debug" PHP CGI processes in Herd?
Maybe try restarting Herd - the debug.ini file gets created when those processes are started for the first time.

@adevade
Copy link
Author

adevade commented Sep 19, 2024

@mpociot Sometimes there's a PHP 8.3 (Debug) in Herd Dashboard.

I actually tried a full reinstall today without any success unfortunately.

@adevade
Copy link
Author

adevade commented Sep 23, 2024

I get the same output on another Windows machine I use for work:

❯ herd php --ini
Configuration File (php.ini) Path:
Loaded Configuration File:         C:\Users\username\.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:         (none)
Scan for additional .ini files in: C:\Users\username\.config\herd\bin\php83
Additional .ini files parsed:      C:\Users\username\.config\herd\bin\php83\php.ini

❯ herd coverage --ini
Configuration File (php.ini) Path:
Loaded Configuration File:         (none)
Scan for additional .ini files in: "C:\Users\username\.config\herd\bin\php83
Additional .ini files parsed:      (none)

@mpociot
Copy link
Member

mpociot commented Sep 24, 2024

@adevade can you share a screenshot of your Herd "dashboard"?
You should see these Debug services.

image

@adevade
Copy link
Author

adevade commented Sep 24, 2024

@mpociot At the moment I do see them, but I'm pretty sure they're not always there.

image

@mpociot
Copy link
Member

mpociot commented Sep 24, 2024

@adevade do you have a minute to look into this via screensharing?
When the debug service starts, we create the debug.ini file. So it is really weird that it doesn't exist for you.

Feel free to join here if you have a minute :)

https://meet.google.com/hrk-xunh-rdg

@adevade
Copy link
Author

adevade commented Sep 24, 2024

@mpociot Unfortunately I'm at work, and can't connect right now. I'm available Thursday and Friday, if that works for you?

Would love to see this fixed, and curious as to what could be causing it!

@mpociot
Copy link
Member

mpociot commented Sep 24, 2024

@adevade no worries!
Could you share your log file with me?

You can find it here: %USERPROFILE%\AppData\Roaming\Herd\logs\main.log

Maybe this already helps to figure out whats going on.

You can schedule a meeting here: https://cal.com/marcel-pociot/15min

@adevade
Copy link
Author

adevade commented Sep 24, 2024

@mpociot
Copy link
Member

mpociot commented Sep 24, 2024

Thanks!
What's interesting is that this entry exists multiple times:

Copying Debug php.ini...
...
[PHP-Debug] INI File: C:\Users\andreas.lundgren\.config\herd\config\php\83\debug\debug.ini

Hm can you verify that these files exist for you?
Maybe they were deleted by some kind of antivirus tool:

C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\xdebug\

There should be a number of DLL files, each for a specific PHP version.

@adevade
Copy link
Author

adevade commented Sep 24, 2024

@mpociot

This is an empty folder on my machine: C:\Users\andreas.lundgren\.config\herd\config\php\83\debug

All DLL files exist in the following folder: C:\Program Files\Herd\resources\app.asar.unpacked\resources\bin\xdebug\


As I mentioned I see the same issue on both my private and work machine. On my private laptop I don't have any antivirus other than Windows Defender, but I've added .config/herd to the ignore list without any success.

If I remove the empty debug folder, and restart Herd services it creates the folder again but it's still empty.

@mpociot
Copy link
Member

mpociot commented Sep 24, 2024

Ugh man...I found the issue in our codebase, and it'll be fixed in the next update!
Sorry about that.

@mpociot
Copy link
Member

mpociot commented Oct 1, 2024

This is now fixed in Herd 1.11.1

@mpociot mpociot closed this as completed Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@mpociot @adevade and others