Skip to content

Commit

Permalink
Clutch of fixes (#134)
Browse files Browse the repository at this point in the history
* update to latest bsc

* chore: Update test project

* chore(plugin): Update to latest bsc

* chore: add tests for no params scenario

* fix: fixes failing tests

* chore(plugin): Remove unused plugin hooks

* fix: Remove empty fail messages, improves error messaging on assert sub type

* chore: Improve output of arrays in logs

* add workspace

* adds diagnostic ignores, and adds missing fields which can cause problems with maestro/bsc enhanced field diagnostics

* typos
  • Loading branch information
georgejecook authored Jul 26, 2021
1 parent e001fca commit 2e3caf8
Show file tree
Hide file tree
Showing 20 changed files with 950 additions and 1,152 deletions.
8 changes: 4 additions & 4 deletions bsc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "4.3.2",
"description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin",
"repository": {
"type": "git",
"url": "https://github.com/georgejecook/rooibos.git"
"type": "git",
"url": "https://github.com/georgejecook/rooibos.git"
},
"files": [
"dist/**/!(*.spec.*)*"
Expand All @@ -23,18 +23,18 @@
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/expect": "^24.3.0",
"@types/fs-extra": "^5.0.1",
"@types/mocha": "^5.2.7",
"@types/sinon": "^9.0.4",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"brighterscript": "^0.37.4",
"brighterscript": "^0.39.0",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"chai-subset": "^1.6.0",
"eslint": "^7.11.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-no-only-tests": "^2.4.0",
"fs-extra": "^9.1.0",
"minimatch": "^3.0.4",
"mocha": "^7.1.1",
"nyc": "^15.1.0",
Expand Down
10 changes: 10 additions & 0 deletions bsc-plugin/rooibos.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"folders": [
{
"path": "../../vsc/brighterscript"
},
{
"path": "."
}
]
}
14 changes: 14 additions & 0 deletions bsc-plugin/src/lib/rooibos/TestSuiteBuilder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,20 @@ end namespace
assertGroupCount(ts, 0, 3);
});

it('param mismatch -no params', () => {
let ts = createTestSuite('test1.bs', `namespace Tests
@suite("Rooibos assertion tests")
class AssertionTests extends Rooibos.BaseTestSuite
@describe("group1")
@it("one")
function test_one(value, arg2)
end function
end class
end namespace
`);
assertSuiteError(ts);
});
it('param mismatch -one', () => {
let ts = createTestSuite('test1.bs', `namespace Tests
@suite("Rooibos assertion tests")
Expand Down
10 changes: 6 additions & 4 deletions bsc-plugin/src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe('RooibosPlugin', () => {
builder.options = util.normalizeAndResolveConfig(options);
builder.program = new Program(builder.options);
program = builder.program;
builder.plugins = new PluginInterface([plugin], undefined);
program.plugins = new PluginInterface([plugin], undefined);
builder.plugins = new PluginInterface([plugin], builder.logger);
program.plugins = new PluginInterface([plugin], builder.logger);
program.createSourceScope(); //ensure source scope is created
plugin.beforeProgramCreate(builder);
plugin.fileFactory.sourcePath = path.resolve(path.join('../framework/src/source'));
Expand Down Expand Up @@ -335,6 +335,7 @@ end function`).trim());
return {
name: "ATest",
isSolo: false,
noCatch: false,
isIgnored: false,
pkgPath: "source/test.spec.bs",
filePath: "/home/george/hope/open-source/rooibos/bsc-plugin/tmp/rootDir/source/test.spec.bs",
Expand Down Expand Up @@ -365,6 +366,7 @@ end function`).trim());
testCases: [
{
isSolo: false,
noCatch: false,
funcName: "groupA_is_test1",
isIgnored: false,
isParamTest: false,
Expand Down Expand Up @@ -455,8 +457,8 @@ end function`).trim());
builder.options = util.normalizeAndResolveConfig(options);
builder.program = new Program(builder.options);
program = builder.program;
builder.plugins = new PluginInterface([plugin], undefined);
program.plugins = new PluginInterface([plugin], undefined);
builder.plugins = new PluginInterface([plugin], builder.logger);
program.plugins = new PluginInterface([plugin], builder.logger);
program.createSourceScope(); //ensure source scope is created
plugin.beforeProgramCreate(builder);
plugin.fileFactory.sourcePath = path.resolve(path.join('../framework/src/source'));
Expand Down
56 changes: 25 additions & 31 deletions bsc-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@ export class RooibosPlugin {
}
}
private getConfig(options: any) {
let config: RooibosConfig = options;
if (config.printTestTimes === undefined) {
config.printTestTimes = true;
}
if (config.catchCrashes === undefined) {
config.catchCrashes = true;
}
if (config.failFast === undefined) {
config.failFast = true;
}
if (config.showOnlyFailures === undefined) {
config.showOnlyFailures = true;
}
if (config.isRecordingCodeCoverage === undefined) {
config.isRecordingCodeCoverage = true;
}
//ignore roku modules by default
if (config.includeFilters === undefined) {
config.includeFilters = [
'**/*.spec.bs',
'!**/BaseTestSuite.spec.bs',
'!**/roku_modules/**/*'];
}

return config
let config: RooibosConfig = options;
if (config.printTestTimes === undefined) {
config.printTestTimes = true;
}
if (config.catchCrashes === undefined) {
config.catchCrashes = true;
}
if (config.failFast === undefined) {
config.failFast = true;
}
if (config.showOnlyFailures === undefined) {
config.showOnlyFailures = true;
}
if (config.isRecordingCodeCoverage === undefined) {
config.isRecordingCodeCoverage = true;
}
//ignore roku modules by default
if (config.includeFilters === undefined) {
config.includeFilters = [
'**/*.spec.bs',
'!**/BaseTestSuite.spec.bs',
'!**/roku_modules/**/*'];
}

return config;
}

afterProgramCreate(program: Program) {
Expand All @@ -72,12 +72,6 @@ export class RooibosPlugin {
}
}

afterScopeCreate() {
}

beforeFileParse(): void {
}

afterFileParse(file: (BrsFile | XmlFile)): void {
// console.log('afp', file.pkgPath);
if (this.fileFactory.isIgnoredFile(file) || !this.shouldSearchInFileForTests(file)) {
Expand Down
Loading

0 comments on commit 2e3caf8

Please sign in to comment.