Skip to content

Commit

Permalink
add output
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBaeumer committed Jan 9, 2021
1 parent eb3964d commit 72790bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/app/test_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func TestCommand(testPath string, ctx TestCommandContext) error {
log.SetOutput(os.Stdout)
}

out, err := output.NewOutput(ctx.Format, !ctx.NoColor)
var err error
out, err = output.NewOutput(ctx.Format, !ctx.NoColor)
if err != nil {
return err
}
Expand Down Expand Up @@ -66,7 +67,6 @@ func TestCommand(testPath string, ctx TestCommandContext) error {
return fmt.Errorf(err.Error())
}


out.PrintSummary(result)
if result.Failed != 0 && !ctx.Verbose {
return fmt.Errorf("Test suite failed, use --verbose for more detailed output")
Expand Down
5 changes: 2 additions & 3 deletions pkg/output/tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewTAPOutputWriter() Output {
}

func (w TAPOutputWriter) GetEventHandler() *runtime.EventHandler {
return nil
return runtime.NewEmptyEventHandler()
}

func (w TAPOutputWriter) PrintSummary(result runtime.Result) {
Expand All @@ -37,8 +37,7 @@ func (w TAPOutputWriter) PrintSummary(result runtime.Result) {
counter++
if r.FailedProperty != "" {
w.fprintf("%d ok - %s", counter+1, r.TestCase.Title)
}
if r.FailedProperty != "" {
} else {
w.fprintf("%d not ok - %s", counter+1, r.TestCase.Title)
}
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,11 @@ func (r *Runtime) Start(tests []TestCase) Result {

return result
}

// NewEmptyEventHandler returns an event handler with empty implementations
func NewEmptyEventHandler() *EventHandler {
return &EventHandler{
TestFinished: func(result TestResult) {},
TestSkipped: func(result TestResult) {},
}
}

0 comments on commit 72790bb

Please sign in to comment.