Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test detection for monorepos #13

Closed
wants to merge 1 commit into from
Closed

Conversation

fredrikaverpil
Copy link
Owner

@fredrikaverpil fredrikaverpil commented May 12, 2024

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 fredrikaverpil self-assigned this May 12, 2024
@@ -12,10 +12,8 @@ M.Adapter = { name = "neotest-golang" }
---@param dir string @Directory to treat as cwd
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing type param for the depth.

@fredrikaverpil fredrikaverpil changed the title Detect nested go projects Improve test detection for monorepos May 12, 2024
@fredrikaverpil fredrikaverpil force-pushed the detect-monorepo branch 4 times, most recently from 5dd1e2a to ee27ed2 Compare May 12, 2024 17:44
@fredrikaverpil
Copy link
Owner Author

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.

@fredrikaverpil fredrikaverpil deleted the detect-monorepo branch June 11, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant