fredrikaverpil / neotest-golang

Reliable Neotest adapter for running Go tests in Neovim.
MIT License
58 stars 6 forks source link

Improve test detection for monorepos #13

Closed fredrikaverpil closed 1 month ago

fredrikaverpil commented 1 month ago

Why this change?

Currently, if the folder in which you start neovim doesn't contain a go.mod/go.sum, tests are not detected.

What was done in this PR?

Search the folder tree for go.mod/go.sum files and if found, return the current working folder as the root of the project. This causes tests to be found in neotest.

Notes

Currently, a max depth of 100 is default, which is on the larger side. This could be set lower, and be configurable.

fredrikaverpil commented 1 month ago

Closing this, as I realize it's likely better to just return the current cwd as the root dir. The reason is neotest-golang is setting the cwd for both go test and dap.