Skip to content

Commit

Permalink
Enhance: pass --color argument to neotest adaper
Browse files Browse the repository at this point in the history
  • Loading branch information
Ydot19 committed Nov 1, 2024
1 parent 7405d2d commit 8422cbd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lua/rustaceanvim/neotest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,18 @@ function NeotestAdapter.build_spec(run_args)
table.insert(args, insert_pos, '--no-fail-fast')
table.insert(args, insert_pos, '--color=never')
if is_cargo_test then
-- cargo test needs to pass --color=never to the test runner too
table.insert(args, '--color=never')
-- filter args at any position
local filtered = vim.tbl_filter(function(v)
return string.match(v, '^--color=')
end, runnable.args.cargoArgs)

if not vim.tbl_isempty(filtered) then
-- add first occurrence of filter argument contain --color
table.insert(args, filtered[0])
else
-- cargo test needs to pass --color=never to the test runner too
table.insert(args, '--color=never')
end
end
---@type rustaceanvim.neotest.RunSpec
---@diagnostic disable-next-line: missing-fields
Expand Down

0 comments on commit 8422cbd

Please sign in to comment.