rust-lang / rust-lang/cargo

Disabling colored output requires convoluted `cargo test --color=never -- --color=never` incantation

Open
#1,983 20 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-cli A-console-output Command-test S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

View all comments

EDIT: see durka's comment below

It seems that there is no way to disable the colored output of cargo test. This is a nice thing to have when displaying output on e.g. CI sites that do not support ASCII escape codes.

Combinations I tried blindly that didn't work include:

  • cargo test --no-color
  • cargo test -- --no-color
  • cargo test --color
  • cargo test -- --color
  • cargo test --color never

Also checked output of cargo -h and cargo test -h but saw nothing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the cargo test command and its handling of arguments, then inspect how color settings are passed to the test runner. Reproduce the current cargo test --color=never -- --color=never behavior and identify the intended single-option interface. Done means cargo test can disable colored output without the repeated flag and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.