From 179ada37aafb51d327f3e5a449a7546c50e27568 Mon Sep 17 00:00:00 2001 From: V13Axel Date: Mon, 5 Feb 2024 16:58:17 -0500 Subject: [PATCH] Better root and test dir matching --- lua/neotest-pest/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/neotest-pest/init.lua b/lua/neotest-pest/init.lua index 5c4a2fa..afde6e6 100644 --- a/lua/neotest-pest/init.lua +++ b/lua/neotest-pest/init.lua @@ -13,7 +13,7 @@ local NeotestAdapter = { name = "neotest-pest" } ---@async ---@param dir string @Directory to treat as cwd ---@return string | nil @Absolute root dir of test suite -NeotestAdapter.root = lib.files.match_root_pattern("composer.json", "pest.xml") +NeotestAdapter.root = lib.files.match_root_pattern("composer.json", "tests/Pest.php") ---Filter directories when searching for test files ---@async @@ -22,7 +22,7 @@ NeotestAdapter.root = lib.files.match_root_pattern("composer.json", "pest.xml") ---@param root string Root directory of project ---@return boolean True when matching function NeotestAdapter.filter_dir(name, rel_path, root) - return name ~= "tests" or string.match(rel_path, "tests") + return vim.startswith(rel_path, "tests") end ---@async