test(test_tool): redirect stderr to stdout and strip ansi codes#8738
test(test_tool): redirect stderr to stdout and strip ansi codes#8738
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
ec1bc70 to
2fc4708
Compare
Greptile SummaryThis PR fixes the Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[mise test-tool <tool>] --> B[Install tool]
B --> C[Build command]
C --> D["Run: sh -c <cmd>\nstderr_to_stdout + stdout_capture"]
D --> E{Exit code?}
E -- "0" --> F[Capture combined stdout+stderr]
E -- "127 (not found)" --> G[Log bin dirs & output]
E -- "other" --> H[Return error]
G --> H
F --> I["miseprintln! raw stdout (ANSI preserved for TTY)"]
I --> J["strip_ansi_codes(stdout) → clean_stdout"]
J --> K{clean_stdout contains expected?}
K -- "yes" --> L[OK ✅]
K -- "no" --> M["Error: expected X, got clean_stdout"]
Reviews (4): Last reviewed commit: "registry: disable imagemagick version te..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR updates mise test-tool output handling so tool tests match against combined output without ANSI formatting, and simplifies registry tool test commands accordingly.
Changes:
- Redirect
stderrtostdoutwhen running tool test commands, and capture the combined output. - Strip ANSI escape codes from captured output before checking for the expected substring.
- Remove redundant
2>&1redirects and ANSI-stripping pipelines from multipleregistry/*.tomltool tests.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/cli/test_tool.rs | Merge stderr into captured output and strip ANSI codes before matching expected output. |
| registry/zprint.toml | Remove 2>&1 from version test command. |
| registry/trzsz-ssh.toml | Remove 2>&1 from version test command. |
| registry/superhtml.toml | Remove 2>&1 from version test command. |
| registry/sbt.toml | Remove 2>&1 from version test command. |
| registry/sampler.toml | Remove 2>&1 from version test command. |
| registry/oc.toml | Remove 2>&1 from version test command. |
| registry/oauth2c.toml | Remove 2>&1 from version test command. |
| registry/minio.toml | Remove 2>&1 from version test command. |
| registry/luajit.toml | Remove 2>&1 from version test command. |
| registry/kubent.toml | Remove 2>&1 from version test command. |
| registry/kscript.toml | Remove 2>&1 from version test command. |
| registry/krab.toml | Remove 2>&1 from version test command. |
| registry/jsonnet-bundler.toml | Remove 2>&1 from version test command. |
| registry/jfrog-cli.toml | Remove 2>&1 from version test command. |
| registry/imagemagick.toml | Remove 2>&1 from version test command. |
| registry/httpie-go.toml | Remove 2>&1 from version test command. |
| registry/gomigrate.toml | Remove 2>&1 from version test command. |
| registry/ffmpeg.toml | Remove 2>&1 from version test command. |
| registry/dagu.toml | Remove 2>&1 from version test command. |
| registry/cidr-merger.toml | Remove 2>&1 from version test command. |
| registry/carapace.toml | Remove 2>&1 from version test command. |
| registry/btop.toml | Drop sed ANSI-stripping workaround; rely on centralized ANSI stripping. |
| registry/bombardier.toml | Remove 2>&1 from version test command. |
| registry/bazel-watcher.toml | Remove 2>&1 from version test command. |
| registry/aws-vault.toml | Update commented-out test command to remove 2>&1. |
| registry/amass.toml | Remove 2>&1 from version test command. |
| registry/agebox.toml | Remove 2>&1 from version test command. |
| registry/aapt2.toml | Remove 2>&1 from version test command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request refactors the mise test-tool command to automatically redirect stderr to stdout and strip ANSI codes from the output before comparison. This is a great improvement that simplifies test definitions in numerous registry/*.toml files by removing manual redirections and ANSI code stripping workarounds. The changes in src/cli/test_tool.rs are well-implemented. The suggestion to improve the clarity of the error message when a test fails remains valid.
02bc136 to
cef094b
Compare
### 🚀 Features - **(github)** add github_tokens.toml, git credential fill, and `mise github token` command by @jdx in [#8742](#8742) - **(registry)** add tart by @mnm364 in [#8727](#8727) ### 🐛 Bug Fixes - **(python)** respect precompiled flavor when excluding freethreaded builds by @risu729 in [#8745](#8745) - **(shim)** revert shims directory check that caused hangs on macOS by @jdx in [e1b8ca4](e1b8ca4) ### 📚 Documentation - **(python)** swap docs for python.precompiled_arch and python.precompiled_os by @risu729 in [#8744](#8744) ### 🧪 Testing - **(test_tool)** redirect stderr to stdout and strip ansi codes by @risu729 in [#8738](#8738) ### New Contributors - @rtharston made their first contribution in [#8731](#8731)
Fixes
nitest.This PR modifies
mise test-toolto redirect stderr to stdout, and then strips ANSI codes from stdout before matching the expected output. It also cleans up unnecessary2>&1redirects and ansi-stripping workarounds inregistry/**tools tests.