neotest-pest icon indicating copy to clipboard operation
neotest-pest copied to clipboard

Automatically detect and use Pest through Sail if exists

Open calebdw opened this issue 2 years ago • 7 comments

Hello!

I'm running Laravel under Docker in my local environment, but use the sail to interact with the container.

Can you please have this plugin automatically detect and use sail? I believe this is what vim-test does for PHPUnit.

Thanks!

calebdw avatar Feb 21 '23 16:02 calebdw

Hello! I don’t use Sail, and I prefer not to litter my machine with Docker stuff if I can avoid it. :) I’d be happy to accept a PR for this, though!

Cheers,

Michael Utz

On Tuesday, Feb 21, 2023 at 7:35 PM, CalebW @.*** @.***)> wrote:

Hello!

I'm running Laravel under Docker in my local environment, but use the sail to interact with the container.

Can you please have this plugin automatically detect and use sail? I believe this is what vim-test does for PHPUnit.

Thanks!

— Reply to this email directly, view it on GitHub (https://github.com/theutz/neotest-pest/issues/2), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAFYU7CKWEHBQRJ4BYO72NDWYTVFJANCNFSM6AAAAAAVDIQMME). You are receiving this because you are subscribed to this thread.Message ID: @.***>

theutz avatar Mar 03 '23 05:03 theutz

+1 i have the same requirement. A very dirty quick fix is to let neotest-pest accept this configuration:

        require('neotest-pest')({
          pest_cmd = function()
            return "sail artisan test"
          end
        }),

instead of (rightfully) complaining: Invalid value for argument cmd: 'sail artisan test' is not executable.

Maybe an option to skip the check ?

thyseus avatar Apr 05 '23 09:04 thyseus

Note that running tests in a Docker container will need relative paths instead of absolute ones...not sure which is used.

calebdw avatar Apr 05 '23 13:04 calebdw

The idea is not to run inside the docker container, but the idea is to let call neovim (natively on your machine outside the container) to "magically" enter the container, run the tests in there and interpret the output in neotest.

thyseus avatar Apr 05 '23 13:04 thyseus

sail is just a wrapper around docker exec which runs the test inside the docker container. You still need to pass relative paths to sail or it won't work

calebdw avatar Apr 05 '23 14:04 calebdw

Ah i see, i got the idea. I think the relative path tests/ ... will be the default for laravel applications and 99,9% of all other applications, too. But would also be cool to be made configurable.

thyseus avatar Apr 05 '23 14:04 thyseus

It should just be relative to the project root which is usually mounted in the docker container under /var/www or /var/www/html

calebdw avatar Apr 05 '23 14:04 calebdw