@@ -6,11 +6,9 @@ import (
66 "log"
77 "os"
88 run "runtime"
9- "sort"
109 "time"
1110
1211 "github.com/SimonBaeumer/commander/pkg/runtime"
13- "github.com/SimonBaeumer/commander/pkg/suite"
1412 "github.com/logrusorgru/aurora"
1513)
1614
@@ -20,15 +18,13 @@ var au aurora.Aurora
2018type OutputWriter struct {
2119 out io.Writer
2220 color bool
23- order bool
2421}
2522
2623// NewCliOutput creates a new OutputWriter with a stdout writer
27- func NewCliOutput (color bool , order bool ) OutputWriter {
24+ func NewCliOutput (color bool ) OutputWriter {
2825 return OutputWriter {
2926 out : os .Stdout ,
3027 color : color ,
31- order : order ,
3228 }
3329}
3430
@@ -39,36 +35,17 @@ func (w *OutputWriter) Start(results <-chan runtime.TestResult) bool {
3935 au = aurora .NewAurora (false )
4036 }
4137
42- var failed int
43- var fileErrors []error
38+ failed := 0
4439 var testResults []runtime.TestResult
4540 start := time .Now ()
4641
4742 for r := range results {
48- if r .FileError != nil {
49- //only append FileErrors that are not title Errors
50- if _ , ok := r .FileError .(* suite.TitleErr ); ! ok {
51- fileErrors = append (fileErrors , fmt .Errorf ("[%s] %s" , r .FileName , r .FileError ))
52- }
53- continue
54- }
5543 testResults = append (testResults , r )
56- if ! w .order { //if no order print now
57- failed += w .readResult (r )
58- }
44+ failed += w .printResult (r )
5945 }
6046
6147 duration := time .Since (start )
6248
63- if w .order { //Maintain file order
64- sort .SliceStable (testResults , func (i , j int ) bool {
65- return testResults [i ].FileName < testResults [j ].FileName
66- })
67- for _ , r := range testResults {
68- failed += w .readResult (r )
69- }
70- }
71-
7249 if failed > 0 {
7350 w .printFailures (testResults )
7451 }
@@ -82,12 +59,10 @@ func (w *OutputWriter) Start(results <-chan runtime.TestResult) bool {
8259 w .fprintf (au .Green (summary ))
8360 }
8461
85- w .printFileErrors (fileErrors )
86-
8762 return failed == 0
8863}
8964
90- func (w * OutputWriter ) readResult (r runtime.TestResult ) int {
65+ func (w * OutputWriter ) printResult (r runtime.TestResult ) int {
9166 if ! r .ValidationResult .Success {
9267 str := fmt .Sprintf ("✗ [%s] %s" , r .Node , r .TestCase .Title )
9368 str = w .addFile (str , r )
@@ -140,18 +115,6 @@ func (w *OutputWriter) addTries(s string, r runtime.TestResult) string {
140115 return s
141116}
142117
143- func (w * OutputWriter ) printFileErrors (errors []error ) {
144- if len (errors ) <= 0 {
145- return
146- }
147-
148- w .fprintf ("" )
149- w .fprintf ("File Errors:" )
150- for _ , e := range errors {
151- w .fprintf (e )
152- }
153- }
154-
155118func (w * OutputWriter ) fprintf (a ... interface {}) {
156119 if _ , err := fmt .Fprintln (w .out , a ... ); err != nil {
157120 log .Fatal (err )
0 commit comments