@@ -23,29 +23,53 @@ import org.junit.runner.notification.RunNotifier
23
23
import org .scalajs .dom .webworkers .DedicatedWorkerGlobalScope
24
24
25
25
import scala .scalajs .js
26
- import scala .util
27
26
28
27
object MacrotaskExecutorSuiteRunner {
29
28
30
- import MacrotaskExecutor .Implicits ._
31
-
32
29
def postMessage (msg : js.Any ): Unit =
33
30
DedicatedWorkerGlobalScope .self.postMessage(msg)
34
31
35
- def main (args : Array [String ]): Unit =
32
+ def main (args : Array [String ]): Unit = {
36
33
new MUnitRunner (
37
34
classOf [MacrotaskExecutorSuite ],
38
35
() => new MacrotaskExecutorSuite
39
36
).runAsync(new RunNotifier {
37
+
38
+ var count = new MacrotaskExecutorSuite ().munitTests().size
39
+ var overallSuccess = true
40
+ def reportTest (success : Boolean ): Unit = {
41
+ overallSuccess &= success
42
+ count -= 1
43
+ if (count == 0 ) postMessage(overallSuccess)
44
+ }
45
+
40
46
def fireTestStarted (description : Description ): Unit = ()
41
- def fireTestSuiteStarted (description : Description ): Unit = ()
47
+
48
+ def fireTestSuiteStarted (description : Description ): Unit =
49
+ postMessage(s " ${classOf [MacrotaskExecutorSuite ].getName}: " )
50
+
51
+ // This doesn't account for async and fires before any tests are run!
42
52
def fireTestSuiteFinished (description : Description ): Unit = ()
53
+
43
54
def fireTestIgnored (description : Description ): Unit = ()
44
- def fireTestFinished (description : Description ): Unit = ()
45
- def fireTestFailure (failure : Failure ): Unit = postMessage(false )
46
- def fireTestAssumptionFailed (failure : Failure ): Unit = postMessage(false )
47
- }).onComplete {
48
- case util.Success (_) => postMessage(true )
49
- case util.Failure (_) => postMessage(false )
50
- }
55
+
56
+ def fireTestFinished (description : Description ): Unit = {
57
+ postMessage(s " + ${description.getMethodName}" )
58
+ reportTest(success = true )
59
+ }
60
+
61
+ def fireTestFailure (failure : Failure ): Unit = {
62
+ postMessage(
63
+ s " ==> X ${classOf [MacrotaskExecutorSuite ].getName}. ${failure.description.getMethodName}"
64
+ )
65
+ reportTest(success = false )
66
+ }
67
+
68
+ def fireTestAssumptionFailed (failure : Failure ): Unit =
69
+ reportTest(success = false )
70
+
71
+ })
72
+
73
+ ()
74
+ }
51
75
}
0 commit comments