Skip to content

test: make stats detail check terminal-independent - #167

Merged
Shengyu Fu (shengyfu) merged 1 commit into
microsoft:mainfrom
mnkj0021:fix/166-stats-test-color
Sep 30, 2026
Merged

Shengyu Fu (shengyfu) merged 1 commit into
microsoft:mainfrom
mnkj0021:fix/166-stats-test-color

Conversation

@mnkj0021

Copy link
Copy Markdown
Contributor

Fixes #166

Summary

  • make stats_requests_match_detail_so_spans_are_available_to_count independent of whether stdout is attached to a terminal
  • pin the test's color mode to ColorMode::Never, so it tests the --stats behavior rather than ambient TTY detection

Validation

  • focused test passes in a pseudo-terminal (script -qec ...)
  • cargo fmt --all -- --check
  • cargo clippy --workspace -- -D warnings
  • git diff --check

cargo test --workspace reaches 286 passing CLI tests but this ARM VPS consistently hits an unrelated existing failure in serve::recovery_tests::subscription_recovery_detects_equal_size_writes_with_restored_mtime. The same failure reproduces on unmodified upstream main; its isolated test passes. The test changed by this PR passes both normally and with stdout attached to a pseudo-terminal.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 01:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The targeted change correctly isolates stats behavior from ambient terminal detection.

Review effort: Balanced
Findings: None

What changed in this PR

Pins the stats test’s color mode to avoid terminal-dependent behavior.

Changes:

  • Sets ColorMode::Never in the affected test.
File Description
tgrep-cli/​src/​search.rs Makes the stats detail test deterministic across TTY and piped output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@shengyfu
Shengyu Fu (shengyfu) merged commit 9a53efc into microsoft:main Sep 30, 2026
1 check passed
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.

cargo test fails in an interactive terminal: stats_requests_match_detail_so_spans_are_available_to_count asserts on ColorMode::Auto

3 participants