Make test framework list out failed tests to use in filter (#10241)

* List out failed tests

* Code review changes
This commit is contained in:
AdRiley 2024-06-11 21:15:28 +01:00 committed by GitHub
parent c4b0ca8f69
commit 783276ca34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,21 +102,26 @@ type Suite
all_results = all_results_bldr.to_vector
succ_tests = all_results.filter (r-> r.is_success) . length
failed_tests = all_results.filter (r-> r.is_fail) . length
failed_tests = all_results.filter (r-> r.is_fail)
failed_tests_number = failed_tests.length
failed_tests_names = failed_tests.map (t-> t.spec_name) . distinct . take 10 . join "|"
skipped_tests = all_results.filter (r-> r.is_pending) . length
pending_groups = matching_specs.filter (p-> p.first.is_pending) . length
case should_exit of
True ->
IO.println ""
IO.println <| succ_tests.to_text + " tests succeeded."
IO.println <| failed_tests.to_text + " tests failed."
IO.println <| failed_tests_number.to_text + " tests failed."
IO.println <| skipped_tests.to_text + " tests skipped."
IO.println <| pending_groups.to_text + " groups skipped."
IO.println ""
exit_code = if failed_tests > 0 then 1 else 0
IO.println <| "Failed tests: '" + failed_tests_names + "'"
if failed_tests_number > 10 then IO.println "(Displaying only first 10 failed tests)"
IO.println ""
exit_code = if failed_tests_number > 0 then 1 else 0
System.exit exit_code
False ->
failed_tests == 0
failed_tests_number == 0
## Gets the names of all the groups in this suite.
group_names self =