VSCode (or other IDE) issue stepping to Helper Functions. #655
Unanswered
jeremy-langevin-twc
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using Pest in tandem with a large Laravel application and I've created a rather large test suite. To aid in readability, I moved my numerous helper methods from inside the
Pest.php
file into other Trait files, which I then import at the top of the Pest.php file, for example:uses(Tests\Helpers\AddressFaker::class)->in('Unit')
. Although implementing this pattern helped me reduce my Pest.php file from > 700 lines to ~90 lines, the major downside was that I can no longer step into methods by right clicking, or see method signatures/args on hover from my test files (invoking them by calling$this->helperMethod($arg1, $arg2)
for example).I want to keep the cleanliness of a small Pest.php file, but allow other developers to view more information about the helper methods from the files they are being used it. Does anyone have any advice to this end?
UPDATE:
As I don't think it's possible to reach the outcome I desired via traits, I used this GitHub issue to inform my process for refactoring. I know have a Tests/Helpers directory, which contains many helper files (no longer traits) containing helper methods. It is a little bit of a pain point that I have to import whichever methods I choose to use into each Test file, but I can now see signatures and step through to methods without having to have a massive Pest.php file.
Beta Was this translation helpful? Give feedback.
All reactions