diff --git a/lua/neotest-bash/core/root_finder.lua b/lua/neotest-bash/core/root_finder.lua index a8e77c6..cf05eb1 100644 --- a/lua/neotest-bash/core/root_finder.lua +++ b/lua/neotest-bash/core/root_finder.lua @@ -7,7 +7,19 @@ SpecBuilder = {} ---@param dir string @Directory to treat as cwd ---@return string | nil @Absolute root dir of test suite function SpecBuilder.findRoot(dir) - return lib.files.match_root_pattern("????")(dir) + -- TODO: check what happens when it's a single file + local matchers = { + ".git", + "lib", + } + for _, matcher in ipairs(matchers) do + local root = lib.files.match_root_pattern(matcher)(dir) + if root then + return root + end + end + + return nil end return SpecBuilder