Skip to content

Commit 152d1e7

Browse files
authored
fix(neotest): prevent running multiple tests when running a single test with cargo-nextest (#619)
1 parent 25aab23 commit 152d1e7

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lua/rustaceanvim/health.lua

+24
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ local lua_dependencies = {
2424

2525
---@class rustaceanvim.ExternalDependency
2626
---@field name string Name of the dependency
27+
---@field required_version_spec? string Version range spec. See `vim.version.range()`
2728
---@field get_binaries fun():string[] Function that returns the binaries to check for
2829
---@field is_installed? fun(bin: string):boolean Default: `vim.fn.executable(bin) == 1`
2930
---@field optional fun():boolean Function that returns whether the dependency is optional
@@ -63,6 +64,13 @@ local check_installed = function(dep)
6364
if error_msg then
6465
return false, binary, error_msg
6566
end
67+
if dep.required_version_spec then
68+
local version_range = vim.version.range(dep.required_version_spec)
69+
if version_range and not version_range:has(binary_version) then
70+
local msg = 'Unsuported version. Required ' .. dep.required_version_spec .. ', but found ' .. binary_version
71+
return false, binary, msg
72+
end
73+
end
6674
return true, binary, binary_version
6775
end
6876
return false, binary, 'Unable to determine version.'
@@ -267,6 +275,22 @@ function health.check()
267275
Set in the config to override the 'cargo' command for debugging and testing.
268276
]],
269277
})
278+
elseif config.tools.enable_nextest then
279+
table.insert(external_dependencies, {
280+
name = 'cargo-nextest',
281+
required_version_spec = '>=0.9.81',
282+
get_binaries = function()
283+
return { 'cargo-nextest' }
284+
end,
285+
optional = function()
286+
return false
287+
end,
288+
url = '[cargo-nextest](https://nexte.st)',
289+
info = [[
290+
Next generation test runner for Rust projects.
291+
Optional dependency, required if the 'tools.enable_nextest' option is set.
292+
]],
293+
})
270294
end
271295

272296
if adapter ~= false then

lua/rustaceanvim/overrides.lua

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function M.try_nextest_transform(args)
4949
table.remove(args, #args)
5050
end
5151
local nextest_unsupported_flags = {
52-
'--exact',
5352
'--show-output',
5453
}
5554
local indexes_to_remove_reverse_order = {}

0 commit comments

Comments
 (0)