Skip to content

Commit

Permalink
feat: simplify project root detection
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed May 12, 2024
1 parent ffe7826 commit c08fa42
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lua/neotest-golang/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ M.Adapter = { name = "neotest-golang" }
---@param dir string @Directory to treat as cwd
---@return string | nil @Absolute root dir of test suite
function M.Adapter.root(dir)
---@type string | nil
local cwd = lib.files.match_root_pattern("go.mod", "go.sum")(dir)
if cwd == nil then
return
end
-- Since neotest-golang is setting the cwd prior to running tests or debugging
-- we can use the cwd as-is and treat it as the root.
return dir
end

---Filter directories when searching for test files
Expand Down

0 comments on commit c08fa42

Please sign in to comment.