Skip to content

Commit

Permalink
[FLAG] Adds keepAppOpen flag (#212)
Browse files Browse the repository at this point in the history
* Adds keepAppOpen flag

* test fix - ensures keepAppOpen is true by default
  • Loading branch information
twig2let authored Apr 19, 2023
1 parent 5cc66a5 commit e4ec4be
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions bsc-plugin/src/lib/rooibos/RooibosConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface RooibosConfig {
tags?: string[];
catchCrashes?: boolean;
sendHomeOnFinish?: boolean;
keepAppOpen?: boolean;

/**
* The path to the folder where the rooibos framework roku files reside.
Expand Down
1 change: 1 addition & 0 deletions bsc-plugin/src/lib/rooibos/RooibosSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class RooibosSession {
"printLcov": ${this.config.printLcov ? 'true' : 'false'}
"port": "${this.config.port || 'invalid'}"
"catchCrashes": ${this.config.catchCrashes ? 'true' : 'false'}
"keepAppOpen": ${this.config.keepAppOpen === undefined || this.config.keepAppOpen ? 'true' : 'false'}
}`
)
);
Expand Down
4 changes: 3 additions & 1 deletion bsc-plugin/src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ describe('RooibosPlugin', () => {
"printLcov": false
"port": "invalid"
"catchCrashes": false
"keepAppOpen": true
}
end function
instance.getTestSuiteClassWithName = function(name)
Expand Down Expand Up @@ -1357,7 +1358,8 @@ describe('RooibosPlugin', () => {
'catchCrashes': true,
'lineWidth': 70,
'failFast': false,
'sendHomeOnFinish': false
'sendHomeOnFinish': false,
'keepAppOpen': true
},
'maestro': {
'nodeFileDelay': 0,
Expand Down
3 changes: 3 additions & 0 deletions bsc-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export class RooibosPlugin implements CompilerPlugin {
if (config.isRecordingCodeCoverage === undefined) {
config.isRecordingCodeCoverage = true;
}
if (config.keepAppOpen === undefined) {
config.keepAppOpen = true;
}
//ignore roku modules by default
if (config.includeFilters === undefined) {
config.includeFilters = [
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ The following options are supported:
- lineWidth?: number - width of test output lines in columns
- catchCrashes? : boolean - if true, then any crashes will report CRASH statement, and note halt test execuction - very useful for running a whole suite
- sendHomeOnFinish? : boolean - if true, then the app will exit upon finish. The default is true. Useful to set to false for local test suites.
- keepAppOpen? : boolean - when true, the app will remain open upon test completion. The default is true. Set false to return execution to Main.
- testsFilePattern?: string - the pattern to use to find tests, this is a glob, the default is "**/*.spec.bs"
- tags?: string[] - the tags listed here control what is run - you can use !tagname to indicated any tests/suites that are skipped, all other tags are ANDed. This is very useful for having a bsconfig to run, say tests including long, and slow integration tests, or just running a certain subset of your suite.

Expand Down
5 changes: 5 additions & 0 deletions framework/src/source/Rooibos.bs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace rooibos
? "scene is ready; running tests now"
runner = new rooibos.TestRunner(scene, m)
runner.Run()

if runner.config.keepAppOpen = false
? "keepAppOpen is false; exiting Rooibos"
return
end if
end if

while true
Expand Down
6 changes: 6 additions & 0 deletions framework/src/source/TestRunner.bs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ namespace rooibos

m.testReporter.reportResults(m.stats)

rooibosResult = {
stats: m.stats
testSuites: m.testSuites
}
m.nodeContext.global.testsScene.rooibosTestResult = rooibosResult

'code coverage is not enabled in rooibos 4.0.0 - will get added again in future
' if Rooibos.Common.isFunction(RBS_reportCodeCoverage)
' 'bs:disable-next-line
Expand Down
3 changes: 2 additions & 1 deletion tests/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"catchCrashes": true,
"lineWidth": 70,
"failFast": false,
"sendHomeOnFinish": false
"sendHomeOnFinish": false,
"keepAppOpen": true
},
"sourceMap": true
}

0 comments on commit e4ec4be

Please sign in to comment.