rooibos-roku 5.12.0 → 5.14.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.
- package/README.md +5 -5
- package/dist/cli.js +109 -0
- package/dist/cli.js.map +1 -0
- package/dist/lib/framework/BaseTestReporter.bs +6 -6
- package/dist/lib/framework/BaseTestSuite.bs +4 -2
- package/dist/lib/framework/CommonUtils.bs +3 -1
- package/dist/lib/framework/ConsoleTestReporter.bs +2 -10
- package/dist/lib/framework/JUnitTestReporter.bs +1 -5
- package/dist/lib/framework/Rooibos.bs +4 -1
- package/dist/lib/framework/RuntimeConfig.bs +9 -0
- package/dist/lib/framework/TestRunner.bs +29 -9
- package/dist/lib/rooibos/Annotation.js +200 -200
- package/dist/lib/rooibos/CodeCoverageProcessor.js +145 -145
- package/dist/lib/rooibos/CodeCoverageType.js +10 -10
- package/dist/lib/rooibos/FileFactory.js +110 -106
- package/dist/lib/rooibos/FileFactory.js.map +1 -1
- package/dist/lib/rooibos/MockUtil.js +177 -174
- package/dist/lib/rooibos/MockUtil.js.map +1 -1
- package/dist/lib/rooibos/RawCodeExpression.js +21 -21
- package/dist/lib/rooibos/RawCodeStatement.js +24 -24
- package/dist/lib/rooibos/RooibosConfig.js +10 -10
- package/dist/lib/rooibos/RooibosSession.js +212 -206
- package/dist/lib/rooibos/RooibosSession.js.map +1 -1
- package/dist/lib/rooibos/RooibosSessionInfo.js +203 -202
- package/dist/lib/rooibos/RooibosSessionInfo.js.map +1 -1
- package/dist/lib/rooibos/TestCase.js +54 -54
- package/dist/lib/rooibos/TestGroup.js +206 -206
- package/dist/lib/rooibos/TestSuite.js +104 -100
- package/dist/lib/rooibos/TestSuite.js.map +1 -1
- package/dist/lib/rooibos/TestSuiteBuilder.js +195 -195
- package/dist/lib/rooibos/Utils.js +115 -115
- package/dist/lib/rooibos/Utils.js.map +1 -1
- package/dist/lib/utils/Diagnostics.js +119 -119
- package/dist/plugin.js +226 -207
- package/dist/plugin.js.map +1 -1
- package/package.json +28 -20
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://github.com/
|
|
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
|
-
[](https://github.com/rokucommunity/rooibos/actions?query=workflow%3Abuild)
|
|
6
|
+
[](https://github.com/rokucommunity/rooibos/releases)
|
|
7
7
|
[](https://npmjs.org/package/rooibos-roku)
|
|
8
8
|
|
|
9
9
|
## Links
|
|
10
|
-
- **[Documentation](https://github.com/
|
|
11
|
-
- **[API Documentation](https://
|
|
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)
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const roku_debug_1 = require("roku-debug");
|
|
5
|
+
const brighterscript_1 = require("brighterscript");
|
|
6
|
+
const yargs = require("yargs");
|
|
7
|
+
const roku_deploy_1 = require("roku-deploy");
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
let options = yargs
|
|
10
|
+
.usage('$0', 'Rooibos: a simple, flexible, fun Brightscript test framework for Roku Scenegraph apps')
|
|
11
|
+
.help('help', 'View help information about this tool.')
|
|
12
|
+
.option('project', { type: 'string', description: 'Path to a bsconfig.json project file.' })
|
|
13
|
+
.option('host', { type: 'string', description: 'Host of the Roku device to connect to. Overrides value in bsconfig file.' })
|
|
14
|
+
.option('password', { type: 'string', description: 'Password of the Roku device to connect to. Overrides value in bsconfig file.' })
|
|
15
|
+
.option('log-level', { type: 'string', defaultDescription: '"log"', description: 'The log level. Value can be "error", "warn", "log", "info", "debug".' })
|
|
16
|
+
.check((argv) => {
|
|
17
|
+
if (!argv.host) {
|
|
18
|
+
return new Error('You must provide a host. (--host)');
|
|
19
|
+
}
|
|
20
|
+
if (!argv.password) {
|
|
21
|
+
return new Error('You must provide a password. (--password)');
|
|
22
|
+
}
|
|
23
|
+
if (!argv.project) {
|
|
24
|
+
console.log('No project file specified. Using "./bsconfig.json"');
|
|
25
|
+
}
|
|
26
|
+
let bsconfigPath = argv.project || './bsconfig.json';
|
|
27
|
+
if (!fs.existsSync(bsconfigPath)) {
|
|
28
|
+
return new Error(`Unable to load ${bsconfigPath}`);
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
})
|
|
32
|
+
.argv;
|
|
33
|
+
async function main() {
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
let currentErrorCode = 0;
|
|
36
|
+
let bsconfigPath = (_a = options.project) !== null && _a !== void 0 ? _a : 'bsconfig.json';
|
|
37
|
+
console.log(`Using bsconfig: ${bsconfigPath}`);
|
|
38
|
+
const rawConfig = brighterscript_1.util.loadConfigFile(bsconfigPath);
|
|
39
|
+
const bsConfig = brighterscript_1.util.normalizeConfig(rawConfig);
|
|
40
|
+
const host = (_b = options.host) !== null && _b !== void 0 ? _b : bsConfig.host;
|
|
41
|
+
const password = (_c = options.password) !== null && _c !== void 0 ? _c : bsConfig.password;
|
|
42
|
+
const logLevel = (_d = brighterscript_1.LogLevel[options['log-level']]) !== null && _d !== void 0 ? _d : bsConfig.logLevel;
|
|
43
|
+
const builder = new brighterscript_1.ProgramBuilder();
|
|
44
|
+
builder.logger.logLevel = logLevel;
|
|
45
|
+
await builder.run(Object.assign(Object.assign({}, options), { retainStagingDir: true, createPackage: true }));
|
|
46
|
+
const rokuDeploy = new roku_deploy_1.RokuDeploy();
|
|
47
|
+
const deviceInfo = await rokuDeploy.getDeviceInfo({ host: host });
|
|
48
|
+
const rendezvousTracker = new roku_debug_1.RendezvousTracker({ softwareVersion: deviceInfo['software-version'] }, { host: host, remotePort: 8085 });
|
|
49
|
+
const telnet = new roku_debug_1.TelnetAdapter({ host: options.host }, rendezvousTracker);
|
|
50
|
+
telnet.logger.logLevel = logLevel;
|
|
51
|
+
await telnet.activate();
|
|
52
|
+
await telnet.connect();
|
|
53
|
+
const failRegex = /RESULT: Fail/g;
|
|
54
|
+
const endRegex = /\[END TEST REPORT\]/g;
|
|
55
|
+
async function doExit(emitAppExit = false) {
|
|
56
|
+
if (emitAppExit) {
|
|
57
|
+
telnet.beginAppExit();
|
|
58
|
+
}
|
|
59
|
+
await rokuDeploy.pressHomeButton(host); // roku-deploy v4: keyPress({ host: options.host, key: 'home' });
|
|
60
|
+
process.exit(currentErrorCode);
|
|
61
|
+
}
|
|
62
|
+
telnet.on('console-output', (output) => {
|
|
63
|
+
console.log(output);
|
|
64
|
+
//check for Fails or Crashes
|
|
65
|
+
let failMatches = failRegex.exec(output);
|
|
66
|
+
if (failMatches && failMatches.length > 0) {
|
|
67
|
+
currentErrorCode = 1;
|
|
68
|
+
}
|
|
69
|
+
let endMatches = endRegex.exec(output);
|
|
70
|
+
if (endMatches && endMatches.length > 0) {
|
|
71
|
+
doExit(true).catch(e => {
|
|
72
|
+
console.error(e);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
telnet.on('runtime-error', (error) => {
|
|
78
|
+
console.error(`Runtime Error: ${error.errorCode} - ${error.message}`);
|
|
79
|
+
currentErrorCode = 1;
|
|
80
|
+
doExit(true).catch(e => {
|
|
81
|
+
console.error(e);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
telnet.on('app-exit', () => {
|
|
86
|
+
doExit(false).catch(e => {
|
|
87
|
+
console.error(e);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
// Actually start the unit tests
|
|
92
|
+
//deploy a .zip package of your project to a roku device
|
|
93
|
+
async function deployBuiltFiles() {
|
|
94
|
+
const outFile = bsConfig.outFile;
|
|
95
|
+
console.log(`Deploying ${outFile} to ${host}`);
|
|
96
|
+
await rokuDeploy.publish({
|
|
97
|
+
password: password,
|
|
98
|
+
host: host,
|
|
99
|
+
outFile: outFile,
|
|
100
|
+
outDir: process.cwd()
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
await deployBuiltFiles();
|
|
104
|
+
}
|
|
105
|
+
main().catch(e => {
|
|
106
|
+
console.error(e);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,2CAA8D;AAE9D,mDAAgE;AAChE,+BAA+B;AAC/B,6CAAyC;AACzC,yBAAyB;AAIzB,IAAI,OAAO,GAAG,KAAK;KACd,KAAK,CAAC,IAAI,EAAE,uFAAuF,CAAC;KACpG,IAAI,CAAC,MAAM,EAAE,wCAAwC,CAAC;KACtD,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;KAC3F,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0EAA0E,EAAE,CAAC;KAC3H,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8EAA8E,EAAE,CAAC;KACnI,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,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K,UAAU,gBAAgB;QAC3B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC;QAC/C,MAAM,UAAU,CAAC,OAAO,CAAC;YACrB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE;SACxB,CAAC,CAAC;IACP,CAAC;IAED,MAAM,gBAAgB,EAAE,CAAC;AAC7B,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
|
17
|
-
m.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
|
|
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
|
|
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
|
-
|
|
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.
|
|
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/
|
|
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
|