Skip to content

Commit 72790bb

Browse files
committed
add output
1 parent eb3964d commit 72790bb

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

pkg/app/test_command.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ func TestCommand(testPath string, ctx TestCommandContext) error {
3333
log.SetOutput(os.Stdout)
3434
}
3535

36-
out, err := output.NewOutput(ctx.Format, !ctx.NoColor)
36+
var err error
37+
out, err = output.NewOutput(ctx.Format, !ctx.NoColor)
3738
if err != nil {
3839
return err
3940
}
@@ -66,7 +67,6 @@ func TestCommand(testPath string, ctx TestCommandContext) error {
6667
return fmt.Errorf(err.Error())
6768
}
6869

69-
7070
out.PrintSummary(result)
7171
if result.Failed != 0 && !ctx.Verbose {
7272
return fmt.Errorf("Test suite failed, use --verbose for more detailed output")

pkg/output/tap.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func NewTAPOutputWriter() Output {
2323
}
2424

2525
func (w TAPOutputWriter) GetEventHandler() *runtime.EventHandler {
26-
return nil
26+
return runtime.NewEmptyEventHandler()
2727
}
2828

2929
func (w TAPOutputWriter) PrintSummary(result runtime.Result) {
@@ -37,8 +37,7 @@ func (w TAPOutputWriter) PrintSummary(result runtime.Result) {
3737
counter++
3838
if r.FailedProperty != "" {
3939
w.fprintf("%d ok - %s", counter+1, r.TestCase.Title)
40-
}
41-
if r.FailedProperty != "" {
40+
} else {
4241
w.fprintf("%d not ok - %s", counter+1, r.TestCase.Title)
4342
}
4443
}

pkg/runtime/runtime.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,11 @@ func (r *Runtime) Start(tests []TestCase) Result {
166166

167167
return result
168168
}
169+
170+
// NewEmptyEventHandler returns an event handler with empty implementations
171+
func NewEmptyEventHandler() *EventHandler {
172+
return &EventHandler{
173+
TestFinished: func(result TestResult) {},
174+
TestSkipped: func(result TestResult) {},
175+
}
176+
}

0 commit comments

Comments
 (0)