Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where enums won't transpile in @sgnode tests #237

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsc-plugin/src/lib/rooibos/RooibosSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class RooibosSession {
diagnosticNoStagingDir(files[0]);
} else {
const filePath = path.join(this._builder.options.stagingDir ?? this._builder.options.stagingFolderPath, 'source/rooibosMain.brs');
fsExtra.writeFileSync(filePath, `function main()\n Rooibos_init("${this.config?.testSceneName ?? 'RooibosScene'}")\nend function`);
fsExtra.outputFileSync(filePath, `function main()\n Rooibos_init("${this.config?.testSceneName ?? 'RooibosScene'}")\nend function`);

}
}
Expand Down
23 changes: 23 additions & 0 deletions bsc-plugin/src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ describe('RooibosPlugin', () => {
expect(plugin.session.sessionInfo.testsCount).to.equal(0);
});

it('transpiles enums in component node tests', async () => {
const file = program.setFile('components/test.spec.bs', `
enum Direction
up = "up"
end enum
namespace tests
@SGNode("Rectangle")
@suite("[Rectangle] Tests")
class ATest extends rooibos.BaseTestSuite
@describe("groupA")

@it("is test1")
function Test()
print Direction.up
end function
end class
end namespace
`);
program.validate();
const contents = await program.getTranspiledFileContents(file.pkgPath);
expect(contents.code).to.include('print "up"');
});

it('multiple groups', () => {
program.setFile('source/test.spec.bs', `
@suite
Expand Down
Loading