better-phpunit icon indicating copy to clipboard operation
better-phpunit copied to clipboard

Add Pest support

Open m1guelpf opened this issue 5 years ago • 6 comments

This PR adds support for Pest alongside PHPUnit.

m1guelpf avatar Jun 29 '20 16:06 m1guelpf

Thanks for submitting this @m1guelpf.

For some reason I assumed that this would make Better PHPUnit automatically detect that a test is a "Pest" test and run it with the Pest binary.

Now I see that it's a config option someone would turn "on".

This makes me wonder.

If I was a user of Pest, this would be fine for projects that use Pest, but what about when I switch to something that doesn't?

Because it runs the vendor/bin binary, I would have to manually toggle that configuration value every time I wanted to run a normal PHPUnit test.

I suppose this same problem would exist if this remained a separate package.

Any thoughts?

calebporzio avatar Aug 13 '20 01:08 calebporzio

What I'm doing currently is having one of the extensions disabled (the one I use less) and toggling them per-workspace. It's not great but it's definitely better than nothing. I can't think of any way to auto-detect Pest unfortunately (maybe @nunomaduro has any ideas?)

m1guelpf avatar Aug 13 '20 10:08 m1guelpf

Could you just detect Pest by looking for vendor/bin/pest? 🤔

owenvoke avatar Aug 13 '20 10:08 owenvoke

You could, but then you'd have to run two commands for each test, which is not ideal.

m1guelpf avatar Aug 13 '20 10:08 m1guelpf

Oh, I was just thinking it could check when your project is set up in VS Code.

owenvoke avatar Aug 13 '20 10:08 owenvoke

Hmmm... I'm not seeing an ideal solution here.

I'm happy to keep these as two different extension if we can't figure something seamless out.

I really don't want to waste all your invested time though @m1guelpf . I feel like a total jerk having requested that you do this (and not thinking it through) and now not merging it.

I'd love to merge it if we can find something automatic, but I want to officially put out there that I fully endorse a "Better Pest" plugin for the record.

If we can find a good way to auto-detect Pest I'm still all ears.

Thanks everyone for pitching in

calebporzio avatar Aug 20 '20 01:08 calebporzio

@calebporzio Can't we do something like having a

ENABLE_PEST=true in our .env file else it will default to phpunit

simonj avatar May 26 '23 13:05 simonj