Repository navigation
Lock down the CLI summary output with tests - #1235
Merged
trunk-io[bot] merged 2 commits intoOct 29, 2026
Merged
trunk-io[bot] merged 2 commits into
trunk-io[bot] merged 2 commits into
Conversation
|
😎 This pull request was merged. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1235 +/- ##
==========================================
+ Coverage 84.43% 85.25% +0.82%
==========================================
Files 78 78
Lines 18633 18613 -20
==========================================
+ Hits 15732 15868 +136
+ Misses 2901 2745 -156 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
dfrankland
commented
Oct 21, 2026
TylerJang27
approved these changes
Oct 26, 2026
dfrankland
force-pushed
the
dylan/trunk-22399-add-tests-that-lock-down-the-current-cli-summary-output
branch
from
October 27, 2026 20:42
a6f5c8a to
d4fd1e7
Compare
Adds tests that compare the plain-text summary line by line for upload, validate and ErrorReport, so the summary-as-data refactors (TRUNK-22401, TRUNK-22402) can show they change nothing. Each type goes through one helper (upload_summary, validate_summary, error_summary), which is the only thing those refactors should need to change. Refs TRUNK-22399 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The lock-down tests move from src/ into one integration test crate, cli/tests/summary, with a file each for upload, validate and ErrorReport. The existing ErrorReport output test moves with them and now checks every line. report_limiting becomes public so the tests can set --validation-report. The validate tests now run run_validate on fixture files instead of building ValidateRunResult, whose fields are private. Refs TRUNK-22399 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dfrankland
force-pushed
the
dylan/trunk-22399-add-tests-that-lock-down-the-current-cli-summary-output
branch
from
October 28, 2026 21:28
d4fd1e7 to
5976f94
Compare
|
This pull request was merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds tests that compare the plain-text summary for
upload,validateandErrorReport, line by line. The upcoming refactors that build these summaries as data, separate from rendering, can use them to show the output doesn't change. No output code changes.The tests live in one integration test crate,
cli/tests/summary/, with a file each forupload,validateandErrorReport. Run them withcargo test -p trunk-analytics-cli --test summary. Each type goes through one helper:upload_summary,validate_summaryorerror_summary. WhenEndOutputis replaced, only those helpers should need to change.Changes outside the tests.
report_limitingis nowpub mod, so the tests can setValidationReport::FullandNone.ErrorReportoutput test moves into the new crate, and now checks every line instead of the first four.What's covered.
--hide-test-collection-links, and no bundle upload ID at all.--show-failure-messages.--validation-reportlimited, full and none, and every file correct.validate, run on fixture files incli/test_fixtures/summary/: a file that can't be parsed, an empty file, a file with two reports, test issues, a CODEOWNERS file with a warning, and a BEP file with a parse error.ErrorReport: connection refused, unauthorized, a client error explanation, a generic error, an interrupting error, and each exit-code line.The
validatetests runrun_validateinstead of building aValidateRunResult, whose fields are private. Every fixture file has at least a missing-timestamp warning, since a fixed timestamp goes stale, so no case has a valid file. The CODEOWNERS path is printed in full, so the helper replaces the crate directory with<cli>. The BEP fixture has no.jsonextension because it is malformed, and prettier only skipscli/test_fixtures/*.json.Today's output, asserted as-is. Some expected lines look wrong because the output is wrong today. They are left alone here:
upload's validation section, a JUnit file that fails to parse is counted under "with issues", but it is never listed.--validation-report nonestill prints a blank line.mainsays "using quarantining exit code", but the CLI exits 0.…was foundCaused by: expected…).Two tests expect
TRUNK_PUBLIC_API_ADDRESSandRUST_BACKTRACEto be unset, as they are in CI. The unauthorized hint reads the API host from the environment, andvalidateprints a parse failure with{:?}, which includes a backtrace when one is captured.Testing.
cargo test -p trunk-analytics-cli --test summary: 29 pass.cargo test -p trunk-analytics-cli --lib: 23 pass.cargo clippy -p trunk-analytics-cli --all-targets: no warnings in the new code.trunk checkon the new and changed files: no issues.🤖 Generated with Claude Code