From effac82a67f83c97aef6c66914fd340e06a66654 Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Wed, 27 Sep 2023 14:25:26 -0400 Subject: [PATCH] Add unit test proving the issue --- bsc-plugin/src/lib/rooibos/RooibosSession.ts | 2 +- bsc-plugin/src/plugin.spec.ts | 23 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/bsc-plugin/src/lib/rooibos/RooibosSession.ts b/bsc-plugin/src/lib/rooibos/RooibosSession.ts index df415951..b1be70f1 100644 --- a/bsc-plugin/src/lib/rooibos/RooibosSession.ts +++ b/bsc-plugin/src/lib/rooibos/RooibosSession.ts @@ -80,7 +80,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`); } } diff --git a/bsc-plugin/src/plugin.spec.ts b/bsc-plugin/src/plugin.spec.ts index 881352aa..0e9d1b31 100644 --- a/bsc-plugin/src/plugin.spec.ts +++ b/bsc-plugin/src/plugin.spec.ts @@ -203,6 +203,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