Skip to content
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
merged 7 commits into from
Aug 29, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions crates/forge/bin/cmd/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
);
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good

Copy link
Member

Choose a reason for hiding this comment

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

let's re-add this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added here: e409e27

std::process::exit(1);
}

Expand All @@ -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()
)
}
Expand Down Expand Up @@ -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
)
}

Expand Down