chiefmyron / phpunit-test-workbench

An extension to integrate PHPUnit with the native Test Explorer functionality within VS Code. Zero configuration required for common environment setups.
https://marketplace.visualstudio.com/items?itemName=chiefmyron.phpunit-test-workbench
MIT License
5 stars 2 forks source link

Shift peek for test failures to appear on the line where the test failure occurred #98

Closed chiefmyron closed 5 months ago

chiefmyron commented 5 months ago

I guess this is more of a feature request too: would it be possible to display the “peek” panel at the failed line too?

SCR-20240502-sclq

Here’s how another plugin I’ve used shows failures:

SCR-20240502-sgxb

I’ve not really worked on VS Code extensions before, but if you can point me where to start, I could take a stab at that.

Originally posted by @macbookandrew in https://github.com/chiefmyron/phpunit-test-workbench/issues/26#issuecomment-2093140495

macbookandrew commented 5 months ago

Awesome — thanks!!

I’m seeing it show up on the wrong line though, I think because it’s using the last line of the stacktrace rather than the last line of code in my actual app:

SCR-20240506-iyhd

chiefmyron commented 5 months ago

Hmm, this looks like something specific to the 10.x release of Laravel, which is why I missed it. Essentially, the Illuminate\Foundation\Testing\TestCase class is extending the runTest() method of the base PHPUnit TestCase class, and so the failure is bubbled up through that class. This method is not extended in the v11.x branch, or v9.x and earlier branches - it is specific only to v10.x.

Will have to check the full set of items in the stack to associate the last message reported against the test class file, rather than relying on it always being the last item in the stack.

macbookandrew commented 5 months ago

this looks like something specific to the 10.x release of Laravel, which is why I missed it. Essentially, the Illuminate\Foundation\Testing\TestCase class is extending the runTest() method of the base PHPUnit TestCase class, and so the failure is bubbled up through that class. This method is not extended in the v11.x branch, or v9.x and earlier branches - it is specific only to v10.x.

oh, interesting…that makes sense. We’ll be upgrading this specific app soon.