From 86737ada67505a6fad98453f732ea3de04ce98aa Mon Sep 17 00:00:00 2001 From: Ziyad Date: Mon, 8 Apr 2024 06:33:10 +0330 Subject: [PATCH] [Feature] Add Customizable Sail Project Path (#6) * Add sail_project_path to config * Use sail_project_path in init.lua * Update README.md --------- Co-authored-by: Ziyad Sfaxi --- README.md | 4 ++++ lua/neotest-pest/config.lua | 1 + lua/neotest-pest/init.lua | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 138fc9e..424a1a8 100644 --- a/README.md +++ b/README.md @@ -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", diff --git a/lua/neotest-pest/config.lua b/lua/neotest-pest/config.lua index 66a5b1b..f14499f 100644 --- a/lua/neotest-pest/config.lua +++ b/lua/neotest-pest/config.lua @@ -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, }, diff --git a/lua/neotest-pest/init.lua b/lua/neotest-pest/init.lua index 954144a..87cffea 100644 --- a/lua/neotest-pest/init.lua +++ b/lua/neotest-pest/init.lua @@ -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({