Skip to content

Commit

Permalink
[Feature] Add Customizable Sail Project Path (#6)
Browse files Browse the repository at this point in the history
* Add sail_project_path to config

* Use sail_project_path in init.lua

* Update README.md

---------

Co-authored-by: Ziyad Sfaxi <[email protected]>
  • Loading branch information
ziyadsfaxi and Ziyad Sfaxi authored Apr 8, 2024
1 parent 2550180 commit 86737ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ adapters = {
-- -- Default: "vendor/bin/sail"
sail_executable = "vendor/bin/sail",

-- Custom sail project root path.
-- -- Default: "/var/www/html"
sail_project_path = "/var/www/html",

-- Custom pest binary.
-- -- Default: function that checks for sail presence
pest_cmd = "vendor/bin/pest",
Expand Down
1 change: 1 addition & 0 deletions lua/neotest-pest/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local M = {
ignore_dirs = { "vendor", "node_modules" },
test_file_suffixes = { "Test.php" },
sail_executable = "vendor/bin/sail",
sail_project_path = "/var/www/html",
parallel = 0,
compact = false,
},
Expand Down
2 changes: 1 addition & 1 deletion lua/neotest-pest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function NeotestAdapter.build_spec(args)

if config('sail_enabled') then
debug("Sail enabled, adjusting path")
path = "/var/www/html" .. string.sub(position.path, string.len(vim.loop.cwd() or "") + 1)
path = config('sail_project_path') .. string.sub(position.path, string.len(vim.loop.cwd() or "") + 1)
end

local command = vim.tbl_flatten({
Expand Down

0 comments on commit 86737ad

Please sign in to comment.