rooibos-roku 5.12.0 → 5.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +5 -5
  2. package/dist/lib/framework/BaseTestReporter.bs +6 -6
  3. package/dist/lib/framework/BaseTestSuite.bs +4 -2
  4. package/dist/lib/framework/CommonUtils.bs +3 -1
  5. package/dist/lib/framework/ConsoleTestReporter.bs +2 -10
  6. package/dist/lib/framework/JUnitTestReporter.bs +1 -5
  7. package/dist/lib/framework/Rooibos.bs +4 -1
  8. package/dist/lib/framework/RuntimeConfig.bs +9 -0
  9. package/dist/lib/framework/TestRunner.bs +29 -9
  10. package/dist/lib/rooibos/Annotation.js +200 -200
  11. package/dist/lib/rooibos/CodeCoverageProcessor.js +145 -145
  12. package/dist/lib/rooibos/CodeCoverageType.js +10 -10
  13. package/dist/lib/rooibos/FileFactory.js +110 -106
  14. package/dist/lib/rooibos/FileFactory.js.map +1 -1
  15. package/dist/lib/rooibos/MockUtil.js +177 -174
  16. package/dist/lib/rooibos/MockUtil.js.map +1 -1
  17. package/dist/lib/rooibos/RawCodeExpression.js +21 -21
  18. package/dist/lib/rooibos/RawCodeStatement.js +24 -24
  19. package/dist/lib/rooibos/RooibosConfig.js +10 -10
  20. package/dist/lib/rooibos/RooibosSession.js +212 -206
  21. package/dist/lib/rooibos/RooibosSession.js.map +1 -1
  22. package/dist/lib/rooibos/RooibosSessionInfo.js +203 -202
  23. package/dist/lib/rooibos/RooibosSessionInfo.js.map +1 -1
  24. package/dist/lib/rooibos/TestCase.js +54 -54
  25. package/dist/lib/rooibos/TestGroup.js +206 -206
  26. package/dist/lib/rooibos/TestSuite.js +104 -100
  27. package/dist/lib/rooibos/TestSuite.js.map +1 -1
  28. package/dist/lib/rooibos/TestSuiteBuilder.js +195 -195
  29. package/dist/lib/rooibos/Utils.js +115 -115
  30. package/dist/lib/rooibos/Utils.js.map +1 -1
  31. package/dist/lib/utils/Diagnostics.js +119 -119
  32. package/dist/plugin.js +226 -207
  33. package/dist/plugin.js.map +1 -1
  34. package/package.json +17 -17
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  <p align="center">
2
- <img src="https://github.com/georgejecook/rooibos/raw/master/images/logo.png" alt="Rooibos test framework" width="200" height="200"/>
2
+ <img src="https://github.com/rokucommunity/rooibos/raw/master/images/logo.png" alt="Rooibos test framework" width="200" height="200"/>
3
3
  </p>
4
4
 
5
- [![build](https://img.shields.io/github/workflow/status/georgejecook/rooibos/build.svg?logo=github)](https://github.com/georgejecook/rooibos/actions?query=workflow%3Abuild)
6
- [![GitHub](https://img.shields.io/github/release/georgejecook/rooibos.svg?style=flat-square)](https://github.com/georgejecook/rooibos/releases)
5
+ [![build](https://img.shields.io/github/workflow/status/rokucommunity/rooibos/build.svg?logo=github)](https://github.com/rokucommunity/rooibos/actions?query=workflow%3Abuild)
6
+ [![GitHub](https://img.shields.io/github/release/rokucommunity/rooibos.svg?style=flat-square)](https://github.com/rokucommunity/rooibos/releases)
7
7
  [![NPM Version](https://badge.fury.io/js/rooibos-roku.svg?style=flat)](https://npmjs.org/package/rooibos-roku)
8
8
 
9
9
  ## Links
10
- - **[Documentation](https://github.com/georgejecook/rooibos/blob/master/docs/index.md)**
11
- - **[API Documentation](https://georgejecook.github.io/rooibos)**
10
+ - **[Documentation](https://github.com/rokucommunity/rooibos/blob/master/docs/index.md)**
11
+ - **[API Documentation](https://rokucommunity.github.io/rooibos)**
12
12
  - \#roku channel on the [roku developer's slack](https://join.slack.com/t/rokudevelopers/shared_invite/enQtMzgyODg0ODY0NDM5LTc2ZDdhZWI2MDBmYjcwYTk5MmE1MTYwMTA2NGVjZmJiNWM4ZWY2MjY1MDY0MmViNmQ1ZWRmMWUzYTVhNzJiY2M)
@@ -1,4 +1,8 @@
1
1
  namespace rooibos
2
+ interface ITestReporterOnEndEvent
3
+ stats as rooibos.Stats
4
+ end interface
5
+
2
6
  class BaseTestReporter
3
7
 
4
8
  public testRunner = invalid
@@ -11,15 +15,11 @@ namespace rooibos
11
15
  m.allStats = runner.stats
12
16
  end function
13
17
 
14
- function reportResults(allStats as dynamic)
15
- 'override me
16
- end function
17
-
18
- function testLogInfo(text as string)
18
+ function onBegin(ev as dynamic)
19
19
  'override me
20
20
  end function
21
21
 
22
- function testLogError(text as string)
22
+ function onEnd(ev as rooibos.ITestReporterOnEndEvent)
23
23
  'override me
24
24
  end function
25
25
 
@@ -199,6 +199,8 @@ namespace rooibos
199
199
  m.testRunner.top.unobserveFieldScoped("rooibosGroupFinished")
200
200
  ' m.testGroupDone()
201
201
  m.onAsyncGroupComplete(group)
202
+ else if m.testRunner.top.rooibosGroupFinished
203
+ m.onAsyncGroupComplete(group)
202
204
  end if
203
205
 
204
206
  end if
@@ -1833,7 +1835,7 @@ namespace rooibos
1833
1835
  end if
1834
1836
 
1835
1837
  if not type(stubOrReturnValue).endsWith("Function")
1836
- throw "Did not provide a stub function"
1838
+ ' throw "Did not provide a stub function"
1837
1839
  end if
1838
1840
 
1839
1841
  ' Store the stub on the component scope
@@ -1906,7 +1908,7 @@ namespace rooibos
1906
1908
  ' m.currentResult.fail("Setting up mock failed: " + error.message, m.currentAssertLineNumber)
1907
1909
  ' return false
1908
1910
  ' end try
1909
- return false
1911
+ ' return false
1910
1912
  end function
1911
1913
 
1912
1914
  ' /**
@@ -334,7 +334,9 @@ namespace rooibos.common
334
334
  'bs:disable-next-line
335
335
  isFirst = false
336
336
  end if
337
- for each key in input
337
+ keys = input.keys()
338
+ keys.sort()
339
+ for each key in keys
338
340
  if rooibos.common.canSafelyIterateAAKey(input, key)
339
341
  text = text + key + ":" + rooibos.common.asString(input[key], includeType)
340
342
  end if
@@ -13,8 +13,8 @@ namespace rooibos
13
13
  end if
14
14
  end function
15
15
 
16
- override function reportResults(allStats)
17
- m.allStats = allStats
16
+ override function onEnd(ev as rooibos.ITestReporterOnEndEvent)
17
+ m.allStats = ev.stats
18
18
  m.startReport()
19
19
  for each testSuite in m.testRunner.testSuites
20
20
  if not m.allStats.hasFailures or ((not m.config.showOnlyFailures) or testSuite.stats.failedCount > 0 or testSuite.stats.crashedCount > 0)
@@ -186,14 +186,6 @@ namespace rooibos
186
186
  '++ printing
187
187
  '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
188
188
 
189
- override function testLogInfo(text)
190
- ? "INFO " ; text
191
- end function
192
-
193
- override function testLogError(text)
194
- ? "ERROR " ; text
195
- end function
196
-
197
189
  function printLine(depth = 0, text = "")
198
190
  ? " " ; text
199
191
  end function
@@ -1,11 +1,7 @@
1
1
  namespace rooibos
2
2
  class JUnitTestReporter extends rooibos.BaseTestReporter
3
3
 
4
- function new(testRunner as dynamic)
5
- super(testRunner)
6
- end function
7
-
8
- override function reportResults(allStats as dynamic)
4
+ override function onEnd(ev as rooibos.ITestReporterOnEndEvent)
9
5
  root = createObject("roXMLElement")
10
6
  root.SetName("testsuites")
11
7
  properties = root.addElement("properties")
@@ -36,6 +36,9 @@ namespace rooibos
36
36
  ? "keepAppOpen is false; exiting Rooibos"
37
37
  ' End statement will also exit the caller of this function
38
38
  ' leading to an instant exit of the application
39
+
40
+ ' Give the io port time to finish sending all the logs
41
+ sleep(400)
39
42
  end
40
43
  end if
41
44
  end if
@@ -91,4 +94,4 @@ namespace rooibos
91
94
  return 0
92
95
 
93
96
  end function
94
- end namespace
97
+ end namespace
@@ -1,16 +1,25 @@
1
1
  namespace rooibos
2
2
  class RuntimeConfig
3
3
 
4
+ function new()
5
+ m.testSuites = m.getTestSuiteClassMap()
6
+ end function
7
+
4
8
  function getVersionText()
5
9
  end function
6
10
 
7
11
  function getRuntimeConfig()
8
12
  end function
9
13
 
14
+ function getTestSuiteClassMap()
15
+ end function
16
+
10
17
  function getTestSuiteClassWithName(name)
18
+ return m.testSuites[name]
11
19
  end function
12
20
 
13
21
  function getAllTestSuitesNames()
22
+ return m.testSuites.keys()
14
23
  end function
15
24
 
16
25
  function getIgnoredTestInfo()
@@ -11,7 +11,7 @@ namespace rooibos
11
11
  ' */
12
12
  class TestRunner
13
13
  public testScene = invalid
14
- public testReporter = invalid
14
+ public testReporters = []
15
15
  public nodeContext = invalid
16
16
  public config = invalid
17
17
  public testSuites = []
@@ -33,11 +33,7 @@ namespace rooibos
33
33
  m.runtimeConfig = new rooibos.RuntimeConfig()
34
34
  m.config = m.runtimeConfig.getRuntimeConfig()
35
35
 
36
- if m.config.reporter = "JUnitTestReporter"
37
- m.testReporter = new Rooibos.JUnitTestReporter(m)
38
- else
39
- m.testReporter = new Rooibos.ConsoleTestReporter(m)
40
- end if
36
+ m.testReporters = m.getTestReporters()
41
37
  end function
42
38
 
43
39
  ' /**
@@ -49,6 +45,12 @@ namespace rooibos
49
45
  ' */
50
46
  public function run()
51
47
 
48
+ for each reporter in m.testReporters
49
+ if rooibos.common.isFunction(reporter.onBegin)
50
+ reporter.onBegin({})
51
+ end if
52
+ end for
53
+
52
54
  rooibosTimer = createObject("roTimespan")
53
55
  rooibosTimer.mark()
54
56
  suiteNames = m.runtimeConfig.getAllTestSuitesNames()
@@ -103,7 +105,11 @@ namespace rooibos
103
105
 
104
106
  m.stats.time = rooibosTimer.totalMilliseconds()
105
107
 
106
- m.testReporter.reportResults(m.stats)
108
+ for each reporter in m.testReporters
109
+ if rooibos.common.isFunction(reporter.onEnd)
110
+ reporter.onEnd({ stats: m.stats })
111
+ end if
112
+ end for
107
113
 
108
114
  rooibosResult = {
109
115
  stats: m.stats
@@ -157,6 +163,7 @@ namespace rooibos
157
163
  ? "Running suite asynchronously!"
158
164
  m.nodeContext.top.observeFieldScoped("rooibosSuiteFinished", "Rooibos_onTestSuiteComplete")
159
165
  testSuite.run()
166
+ return invalid
160
167
  else
161
168
  ? "Running suite synchronously!"
162
169
  testSuite.run()
@@ -264,7 +271,7 @@ namespace rooibos
264
271
  testSuite.stats.merge(nodeResults.stats)
265
272
  m.mergeGroups(testSuite, nodeResults.groups)
266
273
  else
267
- ? " ERROR! The node test"; testSuite.name; " did not indicate test completion. Did you call m.done() in your test? Did you correctly configure your node test? Please refer to : https://github.com/georgejecook/rooibos/blob/master/docs/index.md#testing-scenegraph-nodes"
274
+ ? " ERROR! The node test"; testSuite.name; " did not indicate test completion. Did you call m.done() in your test? Did you correctly configure your node test? Please refer to : https://github.com/rokucommunity/rooibos/blob/master/docs/index.md#testing-scenegraph-nodes"
268
275
  end if
269
276
  m.testScene.removeChild(node)
270
277
  return
@@ -307,6 +314,19 @@ namespace rooibos
307
314
  ut.PostFromString("")
308
315
  end function
309
316
 
317
+ private function getTestReporters()
318
+ reporters = []
319
+ for each factory in m.config.reporters
320
+ if rooibos.common.isFunction(factory)
321
+ reporters.push(factory(m))
322
+ end if
323
+ end for
324
+ if reporters.isEmpty()
325
+ reporters.push(new rooibos.ConsoleTestReporter(m))
326
+ end if
327
+ return reporters
328
+ end function
329
+
310
330
  end class
311
331
 
312
332
  '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -333,4 +353,4 @@ namespace rooibos
333
353
  function onTestSuiteComplete()
334
354
  m.testRunner.onTestSuiteComplete()
335
355
  end function
336
- end namespace
356
+ end namespace