Closed baschnipke closed 2 weeks ago
Reverted to v3.2.2 and it works fine.
Did this happen in version 3.3.4?
I'm also having this issue, yesterday I updated this extension to 3.3.3. Refreshing the tests was causing an error because it was looking in the wrong subdirectory, so I used v3.2.2 instead and it was ok. Now with 3.3.5, the error is gone, but when I refresh tests, the tests don't seem to be detectable.
you can try 3.3.5
Tests are not detectable in 3.3.5 :(
I am also using 3.3.5 and tests are not being detected for me either (MacOS, VSCode 1.95.1)
-mike
https://github.com/user-attachments/assets/96e24eb2-9aed-41b4-bbc9-f6fd88cbf5df
open phpunit.xml and check your tests folder is in testsuite directory
if your phpunit.xml is not in root directory, set configuration phpunit.args = ['-c', 'folder/phpunit.xml']
My phpunit.xml is in my project directory.
Similar to @baschnipke and @ettdro - everything was working fine with the same project, same phpunit.xml, and same configuration prior to the extension's update.
Does this new version have a requirement that all test directories must be listed in <testsuites>
? When I add that to my phpunit.xml things start working again...
-mike
I just updated to v3.3.5 and already had a phpunit.xml file in my root. When I rename or delete that file to something else, the tests show up again. Curious if @ultimike is onto something 🤔
Edit: I just removed the ./
in front of my <testsuites>
definition and that got it working
<testsuites>
<testsuite name="Unit">
- <directory suffix="Test.php">./tests/Unit</directory>
+ <directory suffix="Test.php">tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
- <directory suffix="Test.php">./tests/Feature</directory>
+ <directory suffix="Test.php">tests/Feature</directory>
</testsuite>
</testsuites>
I always have (and need) a phpunit.xml file in my project root. It normally has other <testsuite>
entries.
-mike
https://github.com/user-attachments/assets/a0c997b0-ae1e-4c47-8372-433315f3910d
here is my test
@recca0120 can you share the entire contents of your phpunit.xml file? I don't have the <source>
tag like yours and curious to see if there are more details I'm missing that could be causing a problem
@madebycaliper here is my phpunit.xml for test and this is phpunit.xml for phpunit 11.5
@recca0120 Was there a change in 3.3.5 that changed the way that the extension searches for test classes?
-mike
@ultimike yes, before 3.3.5 I made a mistake
I can't find this error because my test files path is tests lol
Testing this new update out a bit more...
In my phpunit.xml file, I have included the following:
<testsuite name="default">
<directory>modules</directory>
</testsuite>
In my modules directory, there are 5 test classes, with a total of 13 test methods.
In the entire project, including directories outside of modules, there are literally thousands of tests (Drupal core 10.3.6 plus several contrib modules).
With the above configuration of my phpunit.xml file, the extension correctly shows only the tests in my modules directory.
But, when I click the "Run tests" button, ALL tests are run (yes, thousands of them). Obviously, this is not what I was hoping for.
-mike
https://github.com/user-attachments/assets/7f96896a-54d8-40a2-ace4-b1048d91cd5b
I click run all, it only run tests in the testsuite directory
when click run all, the command is vendor/bin/phpunit -c phpunit.xml, phpunit will scan tests by phpunit. not this extension.
I'm not sure what info to provide. I was using the extension to test, then it stopped running tests for some reason so I restarted vscode, let vscode update, and now it just says no tests have been found in this workspace yet. It was working fine before. I'm using WSL2, Docker, and Sail. I've made no changes.
Are others having this issue?