mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Adjust output formatting for fail-blank mode
This commit is contained in:
parent
209ef92d3d
commit
748b0223af
3 changed files with 13 additions and 6 deletions
|
@ -124,7 +124,7 @@ In no particular order, features that have been implemented and are planned:
|
|||
- [ ] Runner
|
||||
- [X] Fail fast
|
||||
- [ ] Test filtering - by name, context, and tags
|
||||
- [ ] Fail on no tests
|
||||
- [X] Fail on no tests
|
||||
- [ ] Randomize test order
|
||||
- [ ] Dry run - for validation and checking formatted output
|
||||
- [X] Config block in `spec_helper.cr`
|
||||
|
|
|
@ -2,12 +2,12 @@ module Spectator::Formatting
|
|||
# Produces a stringified stats counter from result totals.
|
||||
private struct StatsCounter
|
||||
# Creates the instance with each of the counters.
|
||||
private def initialize(@examples : Int32, @failures : Int32, @errors : Int32, @pending : Int32)
|
||||
private def initialize(@examples : Int32, @failures : Int32, @errors : Int32, @pending : Int32, @failed : Bool)
|
||||
end
|
||||
|
||||
# Creates the instance from the counters in a report.
|
||||
def initialize(report)
|
||||
initialize(report.example_count, report.failed_count, report.error_count, report.pending_count)
|
||||
initialize(report.example_count, report.failed_count, report.error_count, report.pending_count, report.failed?)
|
||||
end
|
||||
|
||||
# Produces a colorized formatting for the stats,
|
||||
|
@ -15,7 +15,7 @@ module Spectator::Formatting
|
|||
def color
|
||||
if @errors > 0
|
||||
Color.error(self)
|
||||
elsif @failures > 0
|
||||
elsif @failed || @failures > 0
|
||||
Color.failure(self)
|
||||
elsif @pending > 0
|
||||
Color.pending(self)
|
||||
|
|
|
@ -10,12 +10,19 @@ module Spectator::Formatting
|
|||
# A block describing each failure is displayed.
|
||||
# At the end, the totals and runtime are printed.
|
||||
def end_suite(report)
|
||||
ran_anything = report.examples_ran > 0
|
||||
@io.puts
|
||||
@io.puts
|
||||
failures(report.failures) if report.failed?
|
||||
failures(report.failures) if report.failed? && ran_anything
|
||||
stats(report)
|
||||
remaining(report) if report.remaining?
|
||||
failure_commands(report.failures) if report.failed?
|
||||
if report.failed?
|
||||
if ran_anything
|
||||
failure_commands(report.failures)
|
||||
else # fail-blank mode.
|
||||
@io.puts Color.failure("Failing because no tests were run (fail-blank)")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Produces the failure section of the summary.
|
||||
|
|
Loading…
Reference in a new issue