-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⚡ Improve test summary formatting #5731
Merged
Evalir
merged 7 commits into
foundry-rs:master
from
PraneshASP:chore/test-results-formatting
Aug 29, 2023
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0440ba6
chore: add colors to the test result
PraneshASP 3c9d4f3
chore: remove redundant summary
PraneshASP 9cfeaa2
chore: remove whitespace
PraneshASP c53f2e3
chore: change skipped test count color to yellow
PraneshASP e409e27
refactor: add test summary
PraneshASP 34d015d
chore: update fixtures
Evalir 278e2bf
chore: update
Evalir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -397,13 +397,6 @@ impl TestOutcome { | |
} | ||
println!(); | ||
} | ||
|
||
let successes = self.successes().count(); | ||
println!( | ||
"Encountered a total of {} failing tests, {} tests succeeded", | ||
Paint::red(failures.to_string()), | ||
Paint::green(successes.to_string()) | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's re-add this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added here: e409e27 |
||
std::process::exit(1); | ||
} | ||
|
||
|
@@ -419,9 +412,9 @@ impl TestOutcome { | |
format!( | ||
"Test result: {}. {} passed; {} failed; {} skipped; finished in {:.2?}", | ||
result, | ||
self.successes().count(), | ||
failed, | ||
self.skips().count(), | ||
Paint::green(self.successes().count()), | ||
Paint::red(failed), | ||
Paint::blue(self.skips().count()), | ||
self.duration() | ||
) | ||
} | ||
|
@@ -472,8 +465,12 @@ fn format_aggregated_summary( | |
) -> String { | ||
let total_tests = total_passed + total_failed + total_skipped; | ||
format!( | ||
"Ran {} test suites: {} tests passed, {} failed, {} skipped ({} total tests)", | ||
num_test_suites, total_passed, total_failed, total_skipped, total_tests | ||
" \nRan {} test suites: {} tests passed, {} failed, {} skipped ({} total tests)", | ||
num_test_suites, | ||
Paint::green(total_passed), | ||
Paint::red(total_failed), | ||
Paint::blue(total_skipped), | ||
total_tests | ||
) | ||
} | ||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm why remove this? don't think we should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already display the aggregated test summary for every runs, which was added in #5266.
Ran 4 test suites: 52 tests passed, 2 failed, 0 skipped (54 total tests) Failing tests: .... Encountered a total of 2 failing tests, 52 tests succeeded
The output is redundant in-case of test failures, as the total failed and passed test counts are displayed once again at the end. See attached screenshots above for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I understand your point—but I lean on keeping this for the sake of not making a breaking change on the tool's output. Let's keep it for now as it's something ppl expect to be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good