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

feat(neotest): pass --color argument to neotest adaper #557

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ydot19
Copy link

@Ydot19 Ydot19 commented Nov 1, 2024

Address issue #554

Open Questions / Remarks

  • I am not sure when it is appropriate to check cargoArgs vs cargoExtraArgs. The latter seems deprecated but not sure
  • Will move this out of draft after testing the change

Copy link
Contributor

github-actions bot commented Nov 1, 2024

Review Checklist

Does this PR follow the Contribution Guidelines? Following is a partial checklist:

Proper conventional commit scoping:

  • For example, fix(lsp): some lsp-related bugfix

  • Pull request title has the appropriate conventional commit prefix.

If applicable:

  • Tested
    • Tests have been added.
    • Tested manually (Steps to reproduce in PR description).
  • Updated documentation.

@Ydot19 Ydot19 changed the title Enhance: pass --color argument to neotest adaper enhance: pass --color argument to neotest adaper Nov 1, 2024
Comment on lines +303 to +313
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
Copy link
Owner

@mrcjkb mrcjkb Nov 17, 2024

Choose a reason for hiding this comment

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

Suggested change
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
---@type string | nil
local color_arg = vim.iter(runnable.args.cargoArgs):find(function(arg)
return string.match(arg, '^--color=') ~= nil
end)
if color_arg then
table.insert(args, color_arg)
else
-- cargo test needs to pass --color=never to the test runner too
table.insert(args, '--color=never')
end

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 17, 2024

I am not sure when it is appropriate to check cargoArgs vs cargoExtraArgs. The latter seems deprecated but not sure

Yep, cargoExtraArgs is deprecated. No need to check it.

@mrcjkb mrcjkb changed the title enhance: pass --color argument to neotest adaper feat(neotest): pass --color argument to neotest adaper Nov 18, 2024
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.

2 participants