Skip to content

[feat] cargo config preference option for -- --nocapture #15430

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

Open
loynoir opened this issue Apr 14, 2025 · 3 comments
Open

[feat] cargo config preference option for -- --nocapture #15430

loynoir opened this issue Apr 14, 2025 · 3 comments
Labels
A-configuration Area: cargo config files and env vars C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-test S-triage Status: This issue is waiting on initial triage.

Comments

@loynoir
Copy link

loynoir commented Apr 14, 2025

Problem

Current cargo test ... -- --nocapture cannot written in cargo config alias.

Would be nice to add cargo config preference option for -- --nocapture.

Proposed Solution

[test]
default_nocapture = true

Notes

No response

@loynoir loynoir added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Apr 14, 2025
@epage epage added A-configuration Area: cargo config files and env vars Command-test labels Apr 14, 2025
@epage
Copy link
Contributor

epage commented Apr 14, 2025

Current cargo test ... -- --nocapture cannot written in cargo config alias.

It can't? What happens when you try?

Would be nice to add cargo config preference option for -- --nocapture.

There is the question of how we should respond to custom test harnesses. They may or may not support this flag. I wonder if this should wait until we better integrate cargo test and libtest and allow users to tell cargo the level of integration their custom test harness has, so we know if --nocapture is supported or not.

Could you explain why you would want it in config? --nocapture can be quite noisy and even be hard to read with concurrent test output. It seems like having it in a persistent config would be less than ideal.

@loynoir
Copy link
Author

loynoir commented Apr 14, 2025

Both not working, would be nice to be vvverbose.

[test]
nocapture = true

[alias]
tv = "test $@ -- --nocapture --color always"

@epage
Copy link
Contributor

epage commented Apr 14, 2025

tv = "test $@ -- --nocapture --color always"

So specifically the problem with aliases is the ability to control where arguments go within an alias.

Something I've wondered about is if some libtest CLI arguments should be replicated inside of cargo so that you can do cargo test --nocapture.

Color is being tracked in #1983.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-test S-triage Status: This issue is waiting on initial triage.
Projects
Status: No status
Development

No branches or pull requests

2 participants