rooibos-roku 4.4.2
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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/lib/framework/BaseTestReporter.bs +27 -0
- package/dist/lib/framework/BaseTestSuite.bs +2131 -0
- package/dist/lib/framework/CommonUtils.bs +732 -0
- package/dist/lib/framework/ConsoleTestReporter.bs +200 -0
- package/dist/lib/framework/Coverage.bs +51 -0
- package/dist/lib/framework/Matchers.bs +28 -0
- package/dist/lib/framework/Rooibos.bs +83 -0
- package/dist/lib/framework/RooibosScene.xml +50 -0
- package/dist/lib/framework/RuntimeConfig.bs +20 -0
- package/dist/lib/framework/Stats.bs +46 -0
- package/dist/lib/framework/Test.bs +109 -0
- package/dist/lib/framework/TestGroup.bs +109 -0
- package/dist/lib/framework/TestResult.bs +74 -0
- package/dist/lib/framework/TestRunner.bs +187 -0
- package/dist/lib/framework/Utils.bs +63 -0
- package/dist/lib/framework/unused/CodeCoverage.brs +35 -0
- package/dist/lib/framework/unused/CodeCoverage.xml +13 -0
- package/dist/lib/framework/unused/CodeCoverageSupport.brs +56 -0
- package/dist/lib/rooibos/Annotation.js +187 -0
- package/dist/lib/rooibos/Annotation.js.map +1 -0
- package/dist/lib/rooibos/CodeCoverageProcessor.js +114 -0
- package/dist/lib/rooibos/CodeCoverageProcessor.js.map +1 -0
- package/dist/lib/rooibos/CodeCoverageProcessor.spec.js +62 -0
- package/dist/lib/rooibos/CodeCoverageProcessor.spec.js.map +1 -0
- package/dist/lib/rooibos/CodeCoverageType.js +11 -0
- package/dist/lib/rooibos/CodeCoverageType.js.map +1 -0
- package/dist/lib/rooibos/FileFactory.js +92 -0
- package/dist/lib/rooibos/FileFactory.js.map +1 -0
- package/dist/lib/rooibos/RawCodeStatement.js +21 -0
- package/dist/lib/rooibos/RawCodeStatement.js.map +1 -0
- package/dist/lib/rooibos/RooibosConfig.js +11 -0
- package/dist/lib/rooibos/RooibosConfig.js.map +1 -0
- package/dist/lib/rooibos/RooibosSession.js +151 -0
- package/dist/lib/rooibos/RooibosSession.js.map +1 -0
- package/dist/lib/rooibos/RooibosSessionInfo.js +181 -0
- package/dist/lib/rooibos/RooibosSessionInfo.js.map +1 -0
- package/dist/lib/rooibos/TestCase.js +65 -0
- package/dist/lib/rooibos/TestCase.js.map +1 -0
- package/dist/lib/rooibos/TestGroup.js +86 -0
- package/dist/lib/rooibos/TestGroup.js.map +1 -0
- package/dist/lib/rooibos/TestSuite.js +118 -0
- package/dist/lib/rooibos/TestSuite.js.map +1 -0
- package/dist/lib/rooibos/TestSuiteBuilder.js +192 -0
- package/dist/lib/rooibos/TestSuiteBuilder.js.map +1 -0
- package/dist/lib/rooibos/TestSuiteBuilder.spec.js +1126 -0
- package/dist/lib/rooibos/TestSuiteBuilder.spec.js.map +1 -0
- package/dist/lib/rooibos/Utils.js +173 -0
- package/dist/lib/rooibos/Utils.js.map +1 -0
- package/dist/lib/utils/Diagnostics.js +116 -0
- package/dist/lib/utils/Diagnostics.js.map +1 -0
- package/dist/lib/utils/testHelpers.spec.js +24 -0
- package/dist/lib/utils/testHelpers.spec.js.map +1 -0
- package/dist/plugin.js +116 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeCoverageProcessor.js","sourceRoot":"","sources":["../../../src/lib/rooibos/CodeCoverageProcessor.ts"],"names":[],"mappings":";;;AAKA,MAAa,qBAAqB;IAE9B,YAAY,OAAuB;QAC/B,IAAI,CAAC,OAAO,GAAI,OAAO,CAAC,OAAe,CAAC,OAAwB,IAAI,EAAE,CAAC;QACvE,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI;YACA,2GAA2G;YAC3G,4GAA4G;YAC5G,4GAA4G;YAC5G,8GAA8G;SACjH;QAAC,OAAO,CAAC,EAAE;YACR,kCAAkC;SACrC;IACL,CAAC;IAMM,gBAAgB;QACnB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ACpB,CAAC;IAEM,uBAAuB;QAC1B,+BAA+B;QAC/B,gEAAgE;QAChE,oHAAoH;QACpH,4DAA4D;QAC5D,iCAAiC;QACjC,2BAA2B;QAE3B,gHAAgH;QAChH,qDAAqD;QACrD,+FAA+F;QAC/F,wFAAwF;QACxF,kCAAkC;QAClC,iCAAiC;QACjC,2BAA2B;IAC/B,CAAC;IAEM,qBAAqB;QACxB,+BAA+B;QAC/B,gEAAgE;QAChE,mHAAmH;QACnH,uDAAuD;QACvD,iCAAiC;QACjC,2BAA2B;IAC/B,CAAC;CAGJ;AA1HD,sDA0HC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// import * as chai from 'chai';
|
|
2
|
+
// import * as fs from 'fs-extra';
|
|
3
|
+
// import { Program, ProgramBuilder } from 'brighterscript';
|
|
4
|
+
// import { expect } from 'chai';
|
|
5
|
+
// import * as path from 'path';
|
|
6
|
+
// import { CodeCoverageProcessor } from './CodeCoverageProcessor';
|
|
7
|
+
// import { ProcessorConfig } from './ProcessorConfig';
|
|
8
|
+
// import File from './File';
|
|
9
|
+
// const chaiSubset = require('chai-subset');
|
|
10
|
+
// chai.use(chaiSubset);
|
|
11
|
+
// let processor: CodeCoverageProcessor;
|
|
12
|
+
// let sourcePath = 'src/test/stubProject';
|
|
13
|
+
// let targetPath = 'build';
|
|
14
|
+
// let bsConfig = require('/home/george/hope/open-source/rooibos/rooibos-roku-vsc-extension-plugin/src/test/stubProject/bsconfig.json'
|
|
15
|
+
// );
|
|
16
|
+
// function clearFiles() {
|
|
17
|
+
// fs.removeSync(targetPath);
|
|
18
|
+
// }
|
|
19
|
+
// function copyFiles() {
|
|
20
|
+
// try {
|
|
21
|
+
// fs.copySync(sourcePath, targetPath);
|
|
22
|
+
// } catch (err) {
|
|
23
|
+
// console.error(err);
|
|
24
|
+
// }
|
|
25
|
+
// }
|
|
26
|
+
// describe('CodeCoverageProcessor tests', function() {
|
|
27
|
+
// beforeEach(() => {
|
|
28
|
+
// clearFiles();
|
|
29
|
+
// copyFiles();
|
|
30
|
+
// let _programBuilder = new ProgramBuilder();
|
|
31
|
+
// bsConfig.rootDir = path.resolve('src/test/stubProject/src');
|
|
32
|
+
// processor = new CodeCoverageProcessor(_programBuilder.program);
|
|
33
|
+
// });
|
|
34
|
+
// describe('Process files valid test', function() {
|
|
35
|
+
// it('tests processor runs', async () => {
|
|
36
|
+
// let f: File;
|
|
37
|
+
// await processor.processFile(f);
|
|
38
|
+
// });
|
|
39
|
+
// it('tests creates CodeCoverageSupport file', async () => {
|
|
40
|
+
// let f: File;
|
|
41
|
+
// await processor.processFile(f);
|
|
42
|
+
// let filePath = path.resolve(path.join(targetPath, 'source', 'CodeCoverageSupport.brs'));
|
|
43
|
+
// expect(fs.existsSync(filePath)).to.be.true;
|
|
44
|
+
// });
|
|
45
|
+
// it('tests creates coverage component', async () => {
|
|
46
|
+
// let f: File;
|
|
47
|
+
// await processor.processFile(f);
|
|
48
|
+
// let filePath = path.resolve(path.join(targetPath, 'components', 'CodeCoverage.xml'));
|
|
49
|
+
// expect(fs.existsSync(filePath)).to.be.true;
|
|
50
|
+
// filePath = path.resolve(path.join(targetPath, 'components', 'CodeCoverage.brs'));
|
|
51
|
+
// expect(fs.existsSync(filePath)).to.be.true;
|
|
52
|
+
// });
|
|
53
|
+
// });
|
|
54
|
+
// describe('specific file with lots of code use cases in it', function() {
|
|
55
|
+
// it('tests processor runs', async () => {
|
|
56
|
+
// let f: File;
|
|
57
|
+
// await processor.processFile(f);
|
|
58
|
+
// console.log('TODO - write tests - currently manually validating!!');
|
|
59
|
+
// });
|
|
60
|
+
// });
|
|
61
|
+
// });
|
|
62
|
+
//# sourceMappingURL=CodeCoverageProcessor.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeCoverageProcessor.spec.js","sourceRoot":"","sources":["../../../src/lib/rooibos/CodeCoverageProcessor.spec.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,kCAAkC;AAElC,4DAA4D;AAE5D,iCAAiC;AAEjC,gCAAgC;AAEhC,mEAAmE;AACnE,uDAAuD;AAEvD,6BAA6B;AAE7B,6CAA6C;AAE7C,wBAAwB;AACxB,wCAAwC;AACxC,2CAA2C;AAC3C,4BAA4B;AAE5B,sIAAsI;AACtI,KAAK;AACL,0BAA0B;AAC1B,+BAA+B;AAC/B,IAAI;AAEJ,yBAAyB;AACzB,UAAU;AACV,2CAA2C;AAC3C,oBAAoB;AACpB,0BAA0B;AAC1B,MAAM;AACN,IAAI;AAEJ,uDAAuD;AACvD,uBAAuB;AACvB,oBAAoB;AACpB,mBAAmB;AACnB,kDAAkD;AAClD,mEAAmE;AAEnE,sEAAsE;AACtE,QAAQ;AAER,sDAAsD;AACtD,+CAA+C;AAC/C,qBAAqB;AACrB,wCAAwC;AACxC,UAAU;AACV,iEAAiE;AACjE,qBAAqB;AACrB,wCAAwC;AACxC,iGAAiG;AACjG,oDAAoD;AACpD,UAAU;AACV,2DAA2D;AAC3D,qBAAqB;AACrB,wCAAwC;AACxC,8FAA8F;AAC9F,oDAAoD;AACpD,0FAA0F;AAC1F,oDAAoD;AACpD,UAAU;AACV,QAAQ;AAER,6EAA6E;AAC7E,+CAA+C;AAC/C,qBAAqB;AACrB,wCAAwC;AACxC,6EAA6E;AAC7E,UAAU;AACV,QAAQ;AACR,MAAM"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeCoverageLineType = void 0;
|
|
4
|
+
var CodeCoverageLineType;
|
|
5
|
+
(function (CodeCoverageLineType) {
|
|
6
|
+
CodeCoverageLineType[CodeCoverageLineType["noCode"] = 0] = "noCode";
|
|
7
|
+
CodeCoverageLineType[CodeCoverageLineType["code"] = 1] = "code";
|
|
8
|
+
CodeCoverageLineType[CodeCoverageLineType["condition"] = 2] = "condition";
|
|
9
|
+
CodeCoverageLineType[CodeCoverageLineType["branch"] = 3] = "branch";
|
|
10
|
+
})(CodeCoverageLineType = exports.CodeCoverageLineType || (exports.CodeCoverageLineType = {}));
|
|
11
|
+
//# sourceMappingURL=CodeCoverageType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeCoverageType.js","sourceRoot":"","sources":["../../../src/lib/rooibos/CodeCoverageType.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,mEAAU,CAAA;IACV,+DAAQ,CAAA;IACR,yEAAa,CAAA;IACb,mEAAU,CAAA;AACd,CAAC,EALW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAK/B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileFactory = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
class FileFactory {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.frameworkFileNames = [
|
|
9
|
+
'BaseTestSuite',
|
|
10
|
+
'CommonUtils',
|
|
11
|
+
'Coverage',
|
|
12
|
+
'Matchers',
|
|
13
|
+
'Rooibos',
|
|
14
|
+
'RuntimeConfig',
|
|
15
|
+
'Stats',
|
|
16
|
+
'Test',
|
|
17
|
+
'TestGroup',
|
|
18
|
+
'BaseTestReporter',
|
|
19
|
+
'ConsoleTestReporter',
|
|
20
|
+
'TestResult',
|
|
21
|
+
'TestRunner',
|
|
22
|
+
'Utils'
|
|
23
|
+
];
|
|
24
|
+
this.sourcePath = path.join(__dirname, '../framework');
|
|
25
|
+
this.targetPath = 'source/rooibos/';
|
|
26
|
+
this.targetCompsPath = 'components/rooibos/';
|
|
27
|
+
if (options.frameworkSourcePath) {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
29
|
+
this.sourcePath = options.frameworkSourcePath;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
getFrameworkFiles() {
|
|
33
|
+
let files = [];
|
|
34
|
+
for (let fileName of this.frameworkFileNames) {
|
|
35
|
+
files.push({ src: path.resolve(path.join(this.sourcePath, `${fileName}.bs`)), dest: path.join(this.targetPath, `${fileName}.bs`) });
|
|
36
|
+
}
|
|
37
|
+
files.push({ src: path.resolve(path.join(this.sourcePath, `RooibosScene.xml`)), dest: path.join(this.targetCompsPath, `RooibosScene.xml`) });
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
addFrameworkFiles(program) {
|
|
41
|
+
for (let fileName of this.frameworkFileNames) {
|
|
42
|
+
let sourcePath = path.resolve(path.join(this.sourcePath, `${fileName}.bs`));
|
|
43
|
+
let fileContents = fs.readFileSync(sourcePath, 'utf8');
|
|
44
|
+
let destPath = path.join(this.targetPath, `${fileName}.bs`);
|
|
45
|
+
let entry = { src: sourcePath, dest: destPath };
|
|
46
|
+
program.addOrReplaceFile(entry, fileContents);
|
|
47
|
+
}
|
|
48
|
+
let sourcePath = path.resolve(path.join(this.sourcePath, `RooibosScene.xml`));
|
|
49
|
+
let destPath = path.join(this.targetCompsPath, `RooibosScene.xml`);
|
|
50
|
+
let entry = { src: sourcePath, dest: destPath };
|
|
51
|
+
program.addOrReplaceFile(entry, this.createTestXML('TestsScene', 'Scene'));
|
|
52
|
+
}
|
|
53
|
+
createTestXML(name, baseName, useBs = true) {
|
|
54
|
+
let scriptImports = [];
|
|
55
|
+
for (let fileName of this.frameworkFileNames) {
|
|
56
|
+
scriptImports.push(`<script type="text/bright${useBs ? 'er' : ''}script" uri="pkg:/${this.targetPath}${fileName}.${useBs ? 'bs' : 'brs'}" />`);
|
|
57
|
+
}
|
|
58
|
+
let contents = `<?xml version="1.0" encoding="UTF-8" ?>
|
|
59
|
+
<component
|
|
60
|
+
name="${name}"
|
|
61
|
+
extends="${baseName}">
|
|
62
|
+
${scriptImports.join('\n')}
|
|
63
|
+
<interface>
|
|
64
|
+
<field id="rooibosTestResult" type="assocarray"/>
|
|
65
|
+
</interface>
|
|
66
|
+
<children>
|
|
67
|
+
<LayoutGroup>
|
|
68
|
+
<Label text="Rooibos tests are running" />
|
|
69
|
+
</LayoutGroup>
|
|
70
|
+
</children>
|
|
71
|
+
</component>
|
|
72
|
+
`;
|
|
73
|
+
return contents;
|
|
74
|
+
}
|
|
75
|
+
isIgnoredFile(file) {
|
|
76
|
+
let name = file.pkgPath.toLowerCase();
|
|
77
|
+
let result = this.frameworkFileNames.find((f) => {
|
|
78
|
+
return name === path.join(this.targetPath, `${f}.bs`).toLowerCase();
|
|
79
|
+
});
|
|
80
|
+
return result !== undefined;
|
|
81
|
+
}
|
|
82
|
+
addFile(program, projectPath, contents) {
|
|
83
|
+
try {
|
|
84
|
+
return program.addOrReplaceFile({ src: path.resolve(projectPath), dest: projectPath }, contents);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error(`Error adding framework file: ${projectPath} : ${error.message}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.FileFactory = FileFactory;
|
|
92
|
+
//# sourceMappingURL=FileFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileFactory.js","sourceRoot":"","sources":["../../../src/lib/rooibos/FileFactory.ts"],"names":[],"mappings":";;;AAEA,6BAA6B;AAC7B,yBAAyB;AAEzB,MAAa,WAAW;IAEpB,YAAY,OAAY;QAOhB,uBAAkB,GAAG;YACzB,eAAe;YACf,aAAa;YACb,UAAU;YACV,UAAU;YACV,SAAS;YACT,eAAe;YACf,OAAO;YACP,MAAM;YACN,WAAW;YACX,kBAAkB;YAClB,qBAAqB;YACrB,YAAY;YACZ,YAAY;YACZ,OAAO;SACV,CAAC;QAEK,eAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACjD,eAAU,GAAG,iBAAiB,CAAC;QAC/B,oBAAe,GAAG,qBAAqB,CAAC;QAzB5C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AC5C,OAAO,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACxE,CAAC,CACA,CAAC;QACF,OAAO,MAAM,KAAK,SAAS,CAAC;IAChC,CAAC;IAEM,OAAO,CAAC,OAAO,EAAE,WAAmB,EAAE,QAAgB;QACzD,IAAI;YACA,OAAO,OAAO,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAC;SACpG;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,gCAAgC,WAAW,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;SACnF;IACL,CAAC;CAEJ;AAjGD,kCAiGC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RawCodeStatement = void 0;
|
|
4
|
+
const brighterscript_1 = require("brighterscript");
|
|
5
|
+
const source_map_1 = require("source-map");
|
|
6
|
+
class RawCodeStatement extends brighterscript_1.Statement {
|
|
7
|
+
constructor(source, sourceFile, range = brighterscript_1.Range.create(1, 1, 1, 99999)) {
|
|
8
|
+
super();
|
|
9
|
+
this.source = source;
|
|
10
|
+
this.sourceFile = sourceFile;
|
|
11
|
+
this.range = range;
|
|
12
|
+
}
|
|
13
|
+
transpile(state) {
|
|
14
|
+
return [new source_map_1.SourceNode(this.range.start.line + 1, this.range.start.character, this.sourceFile ? this.sourceFile.pathAbsolute : state.srcPath, this.source)];
|
|
15
|
+
}
|
|
16
|
+
walk(visitor, options) {
|
|
17
|
+
//nothing to walk
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.RawCodeStatement = RawCodeStatement;
|
|
21
|
+
//# sourceMappingURL=RawCodeStatement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RawCodeStatement.js","sourceRoot":"","sources":["../../../src/lib/rooibos/RawCodeStatement.ts"],"names":[],"mappings":";;;AAGA,mDACsC;AAGtC,2CAAwC;AAExC,MAAa,gBAAiB,SAAQ,0BAAS;IAC3C,YACW,MAAc,EACd,UAAoB,EACpB,QAAe,sBAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;QAElD,KAAK,EAAE,CAAC;QAJD,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAU;QACpB,UAAK,GAAL,KAAK,CAAsC;IAGtD,CAAC;IAEM,SAAS,CAAC,KAAwB;QACrC,OAAO,CAAC,IAAI,uBAAU,CAClB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EACzB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAC1B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAC9D,IAAI,CAAC,MAAM,CACd,CAAC,CAAC;IACP,CAAC;IACM,IAAI,CAAC,OAAoB,EAAE,OAAoB;QAClD,iBAAiB;IACrB,CAAC;CACJ;AApBD,4CAoBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RooibosLogLevel = void 0;
|
|
4
|
+
var RooibosLogLevel;
|
|
5
|
+
(function (RooibosLogLevel) {
|
|
6
|
+
RooibosLogLevel[RooibosLogLevel["error"] = 0] = "error";
|
|
7
|
+
RooibosLogLevel[RooibosLogLevel["warning"] = 1] = "warning";
|
|
8
|
+
RooibosLogLevel[RooibosLogLevel["info"] = 2] = "info";
|
|
9
|
+
RooibosLogLevel[RooibosLogLevel["verbose"] = 3] = "verbose";
|
|
10
|
+
})(RooibosLogLevel = exports.RooibosLogLevel || (exports.RooibosLogLevel = {}));
|
|
11
|
+
//# sourceMappingURL=RooibosConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RooibosConfig.js","sourceRoot":"","sources":["../../../src/lib/rooibos/RooibosConfig.ts"],"names":[],"mappings":";;;AACA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,uDAAS,CAAA;IACT,2DAAW,CAAA;IACX,qDAAQ,CAAA;IACR,2DAAW,CAAA;AACf,CAAC,EALW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAK1B"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RooibosSession = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const brighterscript_1 = require("brighterscript");
|
|
6
|
+
const RooibosSessionInfo_1 = require("./RooibosSessionInfo");
|
|
7
|
+
const TestSuiteBuilder_1 = require("./TestSuiteBuilder");
|
|
8
|
+
const RawCodeStatement_1 = require("./RawCodeStatement");
|
|
9
|
+
const Diagnostics_1 = require("../utils/Diagnostics");
|
|
10
|
+
// eslint-disable-next-line
|
|
11
|
+
const pkg = require('../../../package.json');
|
|
12
|
+
class RooibosSession {
|
|
13
|
+
constructor(builder, fileFactory) {
|
|
14
|
+
this.fileFactory = fileFactory;
|
|
15
|
+
this.config = builder.options ? builder.options.rooibos || {} : {};
|
|
16
|
+
this._builder = builder;
|
|
17
|
+
this._suiteBuilder = new TestSuiteBuilder_1.TestSuiteBuilder(this);
|
|
18
|
+
this.reset();
|
|
19
|
+
}
|
|
20
|
+
reset() {
|
|
21
|
+
this.sessionInfo = new RooibosSessionInfo_1.SessionInfo(this.config);
|
|
22
|
+
}
|
|
23
|
+
updateSessionStats() {
|
|
24
|
+
this.sessionInfo.updateInfo();
|
|
25
|
+
}
|
|
26
|
+
processFile(file) {
|
|
27
|
+
let testSuites = this._suiteBuilder.processFile(file);
|
|
28
|
+
return testSuites.length > 0;
|
|
29
|
+
}
|
|
30
|
+
addLaunchHook() {
|
|
31
|
+
let mainFunc = null;
|
|
32
|
+
let files = this._builder.program.getScopeByName('source').getOwnFiles();
|
|
33
|
+
for (let file of files) {
|
|
34
|
+
mainFunc = file.parser.references.functionStatements.find((f) => f.name.text.toLowerCase() === 'main');
|
|
35
|
+
if (mainFunc) {
|
|
36
|
+
mainFunc.func.body.statements.splice(0, 0, new RawCodeStatement_1.RawCodeStatement(`
|
|
37
|
+
Rooibos_init()
|
|
38
|
+
`));
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!mainFunc) {
|
|
43
|
+
Diagnostics_1.diagnosticErrorNoMainFound(files[0]);
|
|
44
|
+
this._builder.program.addOrReplaceFile('source/rooibosMain.brs', `function main()
|
|
45
|
+
Rooibos_init()
|
|
46
|
+
end function`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
addTestRunnerMetadata() {
|
|
50
|
+
let runtimeConfig = this._builder.program.getFileByPkgPath('source/rooibos/RuntimeConfig.bs');
|
|
51
|
+
if (runtimeConfig) {
|
|
52
|
+
let classStatement = runtimeConfig.ast.statements[0].body.statements[0];
|
|
53
|
+
this.updateRunTimeConfigFunction(classStatement);
|
|
54
|
+
this.updateVersionTextFunction(classStatement);
|
|
55
|
+
this.updateClassLookupFunction(classStatement);
|
|
56
|
+
this.updateGetAllTestSuitesNames(classStatement);
|
|
57
|
+
this.createIgnoredTestsInfoFunction(classStatement);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
updateRunTimeConfigFunction(classStatement) {
|
|
61
|
+
var _a;
|
|
62
|
+
let method = classStatement.methods.find((m) => m.name.text === 'getRuntimeConfig');
|
|
63
|
+
if (method) {
|
|
64
|
+
method.func.body.statements.push(new RawCodeStatement_1.RawCodeStatement(`
|
|
65
|
+
return {
|
|
66
|
+
"failFast": ${this.config.failFast ? 'true' : 'false'}
|
|
67
|
+
"logLevel": ${(_a = this.config.logLevel) !== null && _a !== void 0 ? _a : 0}
|
|
68
|
+
"showOnlyFailures": ${this.config.showOnlyFailures ? 'true' : 'false'}
|
|
69
|
+
"printTestTimes": ${this.config.printTestTimes ? 'true' : 'false'}
|
|
70
|
+
"lineWidth": ${this.config.lineWidth || 60}
|
|
71
|
+
"printLcov": ${this.config.printLcov ? 'true' : 'false'}
|
|
72
|
+
"port": "${this.config.port || 'invalid'}"
|
|
73
|
+
"catchCrashes": ${this.config.catchCrashes ? 'true' : 'false'}
|
|
74
|
+
}`));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
updateVersionTextFunction(classStatement) {
|
|
78
|
+
let method = classStatement.methods.find((m) => m.name.text === 'getVersionText');
|
|
79
|
+
if (method) {
|
|
80
|
+
method.func.body.statements.push(new RawCodeStatement_1.RawCodeStatement(`return "${pkg.version}"`));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
updateClassLookupFunction(classStatement) {
|
|
84
|
+
let method = classStatement.methods.find((m) => m.name.text === 'getTestSuiteClassWithName');
|
|
85
|
+
if (method) {
|
|
86
|
+
let text = `
|
|
87
|
+
if false
|
|
88
|
+
? "noop"
|
|
89
|
+
`;
|
|
90
|
+
for (let suite of this.sessionInfo.testSuitesToRun) {
|
|
91
|
+
text += `
|
|
92
|
+
else if name = "${suite.name}"
|
|
93
|
+
return ${suite.classStatement.getName(brighterscript_1.ParseMode.BrightScript)}
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
text += `
|
|
97
|
+
end if`;
|
|
98
|
+
method.func.body.statements.push(new RawCodeStatement_1.RawCodeStatement(text));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
updateGetAllTestSuitesNames(classStatement) {
|
|
102
|
+
let method = classStatement.methods.find((m) => m.name.text === 'getAllTestSuitesNames');
|
|
103
|
+
if (method) {
|
|
104
|
+
let text = `return [
|
|
105
|
+
${this.sessionInfo.testSuitesToRun.filter((s) => !s.isNodeTest)
|
|
106
|
+
.map((s) => `"${s.name}"`).join('\n')}
|
|
107
|
+
]`;
|
|
108
|
+
method.func.body.statements.push(new RawCodeStatement_1.RawCodeStatement(text));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
createNodeFiles(program) {
|
|
112
|
+
let p = path.join('components', 'rooibos', 'generated');
|
|
113
|
+
for (let suite of this.sessionInfo.testSuitesToRun.filter((s) => s.isNodeTest)) {
|
|
114
|
+
let xmlText = this.getNodeTestXmlText(suite);
|
|
115
|
+
let bsPath = path.join(p, `${suite.generatedNodeName}.bs`);
|
|
116
|
+
this.fileFactory.addFile(program, path.join(p, `${suite.generatedNodeName}.xml`), xmlText);
|
|
117
|
+
let bsFile = program.getFileByPkgPath(bsPath);
|
|
118
|
+
if (bsFile) {
|
|
119
|
+
bsFile.parser.statements.push();
|
|
120
|
+
bsFile.needsTranspiled = true;
|
|
121
|
+
}
|
|
122
|
+
let brsFile = this.fileFactory.addFile(program, bsPath, this.getNodeTestBsBody(suite));
|
|
123
|
+
brsFile.parser.invalidateReferences();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
getNodeTestXmlText(suite) {
|
|
127
|
+
return this.fileFactory.createTestXML(suite.generatedNodeName, suite.nodeName);
|
|
128
|
+
}
|
|
129
|
+
getNodeTestBsBody(testSuite) {
|
|
130
|
+
return `import "pkg:/${testSuite.file.pkgPath}"
|
|
131
|
+
function init()
|
|
132
|
+
nodeRunner = Rooibos_TestRunner(m.top.getScene(), m)
|
|
133
|
+
m.top.rooibosTestResult = nodeRunner.runInNodeMode("${testSuite.name}")
|
|
134
|
+
end function
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
137
|
+
createIgnoredTestsInfoFunction(cs) {
|
|
138
|
+
let method = cs.methods.find((m) => m.name.text === 'getIgnoredTestInfo');
|
|
139
|
+
if (method) {
|
|
140
|
+
let text = `return {
|
|
141
|
+
"count": ${this.sessionInfo.ignoredCount}
|
|
142
|
+
"items":[
|
|
143
|
+
${this.sessionInfo.ignoredTestNames.map((name) => `"${name}",`).join('\n')}
|
|
144
|
+
]}
|
|
145
|
+
`;
|
|
146
|
+
method.func.body.statements.push(new RawCodeStatement_1.RawCodeStatement(text));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.RooibosSession = RooibosSession;
|
|
151
|
+
//# sourceMappingURL=RooibosSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RooibosSession.js","sourceRoot":"","sources":["../../../src/lib/rooibos/RooibosSession.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAG7B,mDAA2C;AAG3C,6DAAmD;AACnD,yDAAsD;AACtD,yDAAsD;AAGtD,sDAA+F;AAE/F,2BAA2B;AAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAE7C,MAAa,cAAc;IACvB,YAAY,OAAuB,EAAE,WAAwB;QACzD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAE,OAAO,CAAC,OAAe,CAAC,OAAwB,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,mCAAgB,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IASM,KAAK;QACR,IAAI,CAAC,WAAW,GAAG,IAAI,gCAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAEM,kBAAkB;QACrB,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IAEM,WAAW,CAAC,IAAa;QAC5B,IAAI,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CA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AQ,CAAC,CAAC;IACnF,CAAC;IAEO,iBAAiB,CAAC,SAAoB;QAC1C,OAAO,gBAAgB,SAAS,CAAC,IAAI,CAAC,OAAO;;;4DAGO,SAAS,CAAC,IAAI;;KAErE,CAAC;IACF,CAAC;IAEM,8BAA8B,CAAC,EAAkB;QACpD,IAAI,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC;QAC1E,IAAI,MAAM,EAAE;YACR,IAAI,IAAI,GAAG;qBACF,IAAI,CAAC,WAAW,CAAC,YAAY;;UAExC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;GAE/E,CAAC;YAEQ,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,mCAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;SAChE;IACL,CAAC;CACJ;AAhKD,wCAgKC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSessionInfo = exports.SessionInfo = void 0;
|
|
4
|
+
class SessionInfo {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
this.ignoredCount = 0;
|
|
8
|
+
this.ignoredTestNames = [];
|
|
9
|
+
this.allTestSuites = new Set();
|
|
10
|
+
this.testSuites = new Map();
|
|
11
|
+
this.testSuitesByPath = new Map();
|
|
12
|
+
this.testSuitesToRun = [];
|
|
13
|
+
this.hasSoloSuites = false;
|
|
14
|
+
this.hasSoloGroups = false;
|
|
15
|
+
this.hasSoloTests = false;
|
|
16
|
+
this.testsCount = 0;
|
|
17
|
+
this.suitesCount = 0;
|
|
18
|
+
this.groupsCount = 0;
|
|
19
|
+
this.includeTags = [];
|
|
20
|
+
this.excludeTags = [];
|
|
21
|
+
for (let tag of config.tags || []) {
|
|
22
|
+
if (tag.startsWith('!')) {
|
|
23
|
+
this.excludeTags.push(tag.substr(1));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.includeTags.push(tag);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
updateTestSuites(testSuites) {
|
|
31
|
+
//we can assume at this point that all suites coming in belong to same file
|
|
32
|
+
//incase that is useful in future
|
|
33
|
+
for (let testSuite of testSuites) {
|
|
34
|
+
if (testSuite.isValid && !this.isExcludedByTag(testSuite, false)) {
|
|
35
|
+
this.testSuites.set(testSuite.name, testSuite);
|
|
36
|
+
this.addTestSuiteToPath(testSuite);
|
|
37
|
+
if (testSuite.isSolo) {
|
|
38
|
+
this.hasSoloSuites = !this.hasSoloGroups && !this.hasSoloTests;
|
|
39
|
+
}
|
|
40
|
+
if (testSuite.hasSoloGroups) {
|
|
41
|
+
this.hasSoloGroups = !this.hasSoloTests;
|
|
42
|
+
}
|
|
43
|
+
if (testSuite.hasSoloTests) {
|
|
44
|
+
this.hasSoloTests = true;
|
|
45
|
+
this.hasSoloGroups = false;
|
|
46
|
+
this.hasSoloSuites = false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.allTestSuites.add(testSuite);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this.suitesCount = this.testSuites.size;
|
|
54
|
+
}
|
|
55
|
+
addTestSuiteToPath(testSuite) {
|
|
56
|
+
let suites = this.testSuitesByPath.get(testSuite.file.pkgPath) || [];
|
|
57
|
+
//TODO - I think we could end up with duplicate suites in this case..
|
|
58
|
+
suites.push(testSuite);
|
|
59
|
+
this.testSuitesByPath.set(testSuite.file.pkgPath, suites);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Once we know what's ignored/solo/etc, we can ascertain if we're going
|
|
63
|
+
* to include it in the final json payload
|
|
64
|
+
*/
|
|
65
|
+
updateInfo() {
|
|
66
|
+
for (let testSuite of [...this.testSuites.values()]) {
|
|
67
|
+
if (this.isExcludedByTag(testSuite, false)) {
|
|
68
|
+
testSuite.isIncluded = false;
|
|
69
|
+
}
|
|
70
|
+
else if (this.hasSoloTests && !testSuite.hasSoloTests) {
|
|
71
|
+
testSuite.isIncluded = false;
|
|
72
|
+
}
|
|
73
|
+
else if (this.hasSoloSuites && !testSuite.isSolo) {
|
|
74
|
+
testSuite.isIncluded = false;
|
|
75
|
+
}
|
|
76
|
+
else if (testSuite.isIgnored) {
|
|
77
|
+
testSuite.isIncluded = false;
|
|
78
|
+
this.ignoredTestNames.push(testSuite.name + ' [WHOLE SUITE]');
|
|
79
|
+
this.ignoredCount++;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
testSuite.isIncluded = true;
|
|
83
|
+
}
|
|
84
|
+
if (!testSuite.isIncluded) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
//'testSuite ' + testSuite.name);
|
|
88
|
+
for (let testGroup of testSuite.getTestGroups()) {
|
|
89
|
+
//'GROUP ' + testGroup.name);
|
|
90
|
+
if (testGroup.isIgnored) {
|
|
91
|
+
this.ignoredCount += testGroup.ignoredTestCases.length;
|
|
92
|
+
this.ignoredTestNames.push(testGroup.name + ' [WHOLE GROUP]');
|
|
93
|
+
testGroup.isIncluded = false;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
if (testGroup.ignoredTestCases.length > 0) {
|
|
97
|
+
this.ignoredTestNames.push(testGroup.name);
|
|
98
|
+
this.ignoredCount += testGroup.ignoredTestCases.length;
|
|
99
|
+
for (let ignoredTestCase of testGroup.ignoredTestCases) {
|
|
100
|
+
if (!ignoredTestCase.isParamTest) {
|
|
101
|
+
this.ignoredTestNames.push(ignoredTestCase.name);
|
|
102
|
+
}
|
|
103
|
+
else if (ignoredTestCase.paramTestIndex === 0) {
|
|
104
|
+
let testCaseName = ignoredTestCase.name;
|
|
105
|
+
if (testCaseName.length > 1 && testCaseName.substr(testCaseName.length - 1) === '0') {
|
|
106
|
+
testCaseName = testCaseName.substr(0, testCaseName.length - 1);
|
|
107
|
+
}
|
|
108
|
+
this.ignoredTestNames.push(testCaseName);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (this.isExcludedByTag(testGroup, true)) {
|
|
113
|
+
testGroup.isIncluded = false;
|
|
114
|
+
}
|
|
115
|
+
else if (this.hasSoloTests && !testGroup.hasSoloTests) {
|
|
116
|
+
testGroup.isIncluded = false;
|
|
117
|
+
}
|
|
118
|
+
else if (this.hasSoloGroups && !testGroup.isSolo) {
|
|
119
|
+
testGroup.isIncluded = false;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
testGroup.isIncluded = true;
|
|
123
|
+
}
|
|
124
|
+
if (testGroup.isIncluded) {
|
|
125
|
+
this.groupsCount++;
|
|
126
|
+
let testCases = [...testGroup.testCases.values()];
|
|
127
|
+
for (let testCase of testCases) {
|
|
128
|
+
if (this.isExcludedByTag(testCase, true)) {
|
|
129
|
+
testCase.isIncluded = false;
|
|
130
|
+
}
|
|
131
|
+
else if (testCase.isIgnored) {
|
|
132
|
+
testCase.isIncluded = false;
|
|
133
|
+
}
|
|
134
|
+
else if (this.hasSoloTests && !testCase.isSolo) {
|
|
135
|
+
testCase.isIncluded = false;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
testCase.isIncluded = testGroup.isIncluded || testCase.isSolo;
|
|
139
|
+
this.testsCount++;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (let testCase of testGroup.soloTestCases) {
|
|
143
|
+
if (this.isExcludedByTag(testCase, true)) {
|
|
144
|
+
testCase.isIncluded = false;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
testCase.isIncluded = true;
|
|
148
|
+
this.testsCount++;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
this.testSuitesToRun = [...this.testSuites.values()].filter((s) => s.isIncluded);
|
|
156
|
+
}
|
|
157
|
+
isExcludedByTag(item, isParentIncluded) {
|
|
158
|
+
if (this.excludeTags.length > 0) {
|
|
159
|
+
for (let tag of this.excludeTags) {
|
|
160
|
+
if (item.annotation.tags.has(tag)) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (this.includeTags.length > 0 && (item.annotation.tags.size > 0 || !isParentIncluded)) {
|
|
166
|
+
for (let tag of this.includeTags) {
|
|
167
|
+
if (!item.annotation.tags.has(tag)) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.SessionInfo = SessionInfo;
|
|
176
|
+
let _sessionInfo;
|
|
177
|
+
function getSessionInfo() {
|
|
178
|
+
return _sessionInfo;
|
|
179
|
+
}
|
|
180
|
+
exports.getSessionInfo = getSessionInfo;
|
|
181
|
+
//# sourceMappingURL=RooibosSessionInfo.js.map
|