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

fix(neotest): prevent running multiple tests when running a single test with cargo-nextest #619

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions lua/rustaceanvim/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local lua_dependencies = {

---@class rustaceanvim.ExternalDependency
---@field name string Name of the dependency
---@field required_version_spec? string Version range spec. See `vim.version.range()`
---@field get_binaries fun():string[] Function that returns the binaries to check for
---@field is_installed? fun(bin: string):boolean Default: `vim.fn.executable(bin) == 1`
---@field optional fun():boolean Function that returns whether the dependency is optional
Expand Down Expand Up @@ -63,6 +64,13 @@ local check_installed = function(dep)
if error_msg then
return false, binary, error_msg
end
if dep.required_version_spec then
local version_range = vim.version.range(dep.required_version_spec)
if version_range and not version_range:has(binary_version) then
local msg = 'Unsuported version. Required ' .. dep.required_version_spec .. ', but found ' .. binary_version
return false, binary, msg
end
end
return true, binary, binary_version
end
return false, binary, 'Unable to determine version.'
Expand Down Expand Up @@ -267,6 +275,22 @@ function health.check()
Set in the config to override the 'cargo' command for debugging and testing.
]],
})
elseif config.tools.enable_nextest then
table.insert(external_dependencies, {
name = 'cargo-nextest',
required_version_spec = '>=0.9.81',
get_binaries = function()
return { 'cargo-nextest' }
end,
optional = function()
return false
end,
url = '[cargo-nextest](https://nexte.st)',
info = [[
Next generation test runner for Rust projects.
Optional dependency, required if the 'tools.enable_nextest' option is set.
]],
})
end

if adapter ~= false then
Expand Down
1 change: 0 additions & 1 deletion lua/rustaceanvim/overrides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function M.try_nextest_transform(args)
table.remove(args, #args)
end
local nextest_unsupported_flags = {
'--exact',
'--show-output',
}
local indexes_to_remove_reverse_order = {}
Expand Down
Loading