olimorris / neotest-phpunit

🧪 Neotest adapter for PHPUnit
MIT License
33 stars 23 forks source link

Allow to swap executable #5

Closed haringsrob closed 2 years ago

haringsrob commented 2 years ago

Hey,

Here again :).

So in my work I regularly have nested projects. For example a laravel installation, with a set of packages.

LaravelRoot/
  packages/
    package1/
      composer.json
      vendor/...

I do not know if it is possible to somehow swap the executable to use the closest vendor folder? This so it uses the phpunit config corresponding to the context it is in.

(package1 should use /LaravelRoot/packages/package1/vendor/bin/phpunit instead of /LaravelRoot/vendor/bin/phpunit)

https://github.com/olimorris/neotest-phpunit/blob/6817e60386a23a860cf514d95030e35a82c2303b/lua/neotest-phpunit/init.lua#L60

olimorris commented 2 years ago

Not quite sure of an eloquent way of doing this but totally up for a pull request.

You could always pass a present working directory value to the adapter which it then uses in the NeotestAdapter.build_spec function. Or...what happens if you change Neovim's pwd and run Neotest?