Skip to content

Conversation

VanjaRo
Copy link
Contributor

@VanjaRo VanjaRo commented Oct 7, 2025

Summary

  • vector test now disables ANSI color when non-interactive (e.g., CI), preventing escape codes in logs.
  • All VRL diagnostics (compile errors/warnings, runtime errors) respect the global color setting.
  • Minor: fix a logging field typo in runtime init debug message.

Vector configuration

# Default (auto): color enabled only when stdout is a TTY
vector test

# Force enable color
vector --color always test

# Force disable color
vector --color never test

# Using environment variable
VECTOR_COLOR=always vector test
VECTOR_COLOR=never vector test

# Non-interactive scenario (auto → no color)
vector test | tee out.txt

How did you test this PR?

  • Verified TTY detection: --color auto shows ANSI when run in an interactive terminal, and no ANSI when piped/redirected.
  • Forced behaviors validated with --color always|never and VECTOR_COLOR=always|never.
  • Confirmed VRL diagnostics across validate, conditions (src/conditions/vrl.rs), remap transform, HTTP server auth, and HTTP client query parameters show colored output only when enabled.
  • Ensured init_logging and downstream modules receive the same global color preference via set_global_color(...).
  • Spot-checked that CI-like environments (piped output) produce log lines without ANSI sequences.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

@VanjaRo VanjaRo requested a review from a team as a code owner October 7, 2025 10:03
@github-actions github-actions bot added domain: sources Anything related to the Vector's sources domain: transforms Anything related to Vector's transform components labels Oct 7, 2025
@VanjaRo VanjaRo changed the title enhancement(unit tests): respect color flag for tests feature(unit tests): respect color flag for tests Oct 7, 2025
@VanjaRo VanjaRo changed the title feature(unit tests): respect color flag for tests feat(unit tests): respect color flag for tests Oct 7, 2025
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Thanks @VanjaRo

@pront pront added no-changelog Changes in this PR do not need user-facing explanations in the release changelog and removed no-changelog Changes in this PR do not need user-facing explanations in the release changelog labels Oct 7, 2025
@pront pront enabled auto-merge October 7, 2025 15:10
@thomasqueirozb thomasqueirozb added the meta: awaiting author Pull requests that are awaiting their author. label Oct 7, 2025
auto-merge was automatically disabled October 7, 2025 15:42

Head branch was pushed to by a user without write access

@github-actions github-actions bot removed the meta: awaiting author Pull requests that are awaiting their author. label Oct 7, 2025
@VanjaRo
Copy link
Contributor Author

VanjaRo commented Oct 7, 2025

Sry, I accidentally pushed the wrong class name for multiple Diagnostics. Fixed.

@pront
Copy link
Member

pront commented Oct 7, 2025

Sry, I accidentally pushed the wrong class name for multiple Diagnostics. Fixed.

Did you have a chance to repeat the tests with the latest version?

@VanjaRo
Copy link
Contributor Author

VanjaRo commented Oct 7, 2025

Sry, I accidentally pushed the wrong class name for multiple Diagnostics. Fixed.

Did you have a chance to repeat the tests with the latest version?

Yep, tests and check –– same output as master.

@pront pront enabled auto-merge October 7, 2025 18:33
auto-merge was automatically disabled October 7, 2025 19:20

Head branch was pushed to by a user without write access

@pront pront enabled auto-merge October 7, 2025 20:43
@pront pront added this pull request to the merge queue Oct 7, 2025
Merged via the queue into vectordotdev:master with commit 6a8dccc Oct 7, 2025
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: sources Anything related to the Vector's sources domain: transforms Anything related to Vector's transform components hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vector test should not colorize unless it is running interactively
3 participants