Skip to content

Commit

Permalink
Tweak reporter method signature to accept event AA
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-j-soares committed Apr 9, 2024
1 parent 8f522dd commit c2f0b2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions framework/src/source/BaseTestReporter.bs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace rooibos
interface TestReporterOnEndEvent
stats as rooibos.Stats
end interface

class BaseTestReporter

public testRunner = invalid
Expand All @@ -11,11 +15,11 @@ namespace rooibos
m.allStats = runner.stats
end function

function onBegin()
function onBegin(ev as dynamic)
'override me
end function

function onEnd(allStats as dynamic)
function onEnd(ev as rooibos.TestReporterOnEndEvent)
'override me
end function

Expand Down
4 changes: 2 additions & 2 deletions framework/src/source/ConsoleTestReporter.bs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace rooibos
end if
end function

override function onEnd(allStats)
m.allStats = allStats
override function onEnd(ev as rooibos.TestReporterOnEndEvent)
m.allStats = ev.stats
m.startReport()
for each testSuite in m.testRunner.testSuites
if not m.allStats.hasFailures or ((not m.config.showOnlyFailures) or testSuite.stats.failedCount > 0 or testSuite.stats.crashedCount > 0)
Expand Down
2 changes: 1 addition & 1 deletion framework/src/source/JUnitTestReporter.bs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace rooibos
class JUnitTestReporter extends rooibos.BaseTestReporter

override function onEnd(allStats as dynamic)
override function onEnd(ev as rooibos.TestReporterOnEndEvent)
root = createObject("roXMLElement")
root.SetName("testsuites")
properties = root.addElement("properties")
Expand Down
4 changes: 2 additions & 2 deletions framework/src/source/TestRunner.bs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace rooibos

for each reporter in m.testReporters
if rooibos.common.isFunction(reporter.onBegin)
reporter.onBegin()
reporter.onBegin({})
end if
end for

Expand Down Expand Up @@ -107,7 +107,7 @@ namespace rooibos

for each reporter in m.testReporters
if rooibos.common.isFunction(reporter.onEnd)
reporter.onEnd(m.stats)
reporter.onEnd({ stats: m.stats })
end if
end for

Expand Down

0 comments on commit c2f0b2f

Please sign in to comment.