Skip to content

Commit

Permalink
Merge branch 'feature/mocha-test-reporter' into bugfix/only-annotatio…
Browse files Browse the repository at this point in the history
…n-not-always-applied-correctly
  • Loading branch information
chrisdp authored Jan 22, 2025
2 parents eec8d22 + e5f43b4 commit c461df0
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 89 deletions.
2 changes: 1 addition & 1 deletion bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe('RooibosPlugin', () => {
expect(a).to.equal(b);
});

it.skip('correctly transpiles some statements', async () => {
it('correctly transpiles some statements', async () => {
const source = `sub foo()
x = function(y)
if (true) then
Expand Down
12 changes: 2 additions & 10 deletions bsc-plugin/src/lib/rooibos/TestCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export class TestCase {
this.lineNumber = lineNumber;
this.paramLineNumber = paramLineNumber;
this.assertIndex = 0;
this.assertLineNumberMap = {};
this.rawParams = params;
this.expectedNumberOfParams = expectedNumberOfParams;
this.paramTestIndex = paramTestIndex;
Expand All @@ -37,7 +36,6 @@ export class TestCase {
public paramLineNumber: number;
public assertIndex: number;
public expectedNumberOfParams: number;
public assertLineNumberMap: any;
public rawParams: any[];
public paramTestIndex: number;

Expand All @@ -55,22 +53,16 @@ export class TestCase {
slow: ${this.slow}
isParamTest: ${this.isParamTest}
name: ${sanitizeBsJsonString(this.name)}
lineNumber: ${this.lineNumber + 2}
paramLineNumber: ${this.paramLineNumber}
lineNumber: ${this.lineNumber + 1}
paramLineNumber: ${this.isParamTest ? this.paramLineNumber + 1 : 0}
assertIndex: ${this.assertIndex}
assertLineNumberMap: ${JSON.stringify(this.assertLineNumberMap)}
rawParams: ${rawParamsText}
paramTestIndex: ${this.paramTestIndex}
expectedNumberOfParams: ${this.expectedNumberOfParams}
isParamsValid: ${(this.rawParams || []).length === this.expectedNumberOfParams}
}`;
}

public addAssertLine(lineNumber: number) {
this.assertLineNumberMap[this.assertIndex.toString().trim()] = lineNumber;
this.assertIndex++;
}

fixBadJson(o) {
// In case of an array we'll stringify all objects.
if (Array.isArray(o)) {
Expand Down
4 changes: 2 additions & 2 deletions bsc-plugin/src/lib/rooibos/TestGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class TestGroup extends TestBlock {
const trailingLine = Parser.parse(`if m.currentResult?.isFail = true then m.done() : return ${isSub ? '' : 'invalid'}`).ast.statements[0];
editor.arraySplice(owner, key + 1, 0, trailingLine);
}
const leadingLine = Parser.parse(`m.currentAssertLineNumber = ${callExpression.range.start.line}`).ast.statements[0];
const leadingLine = Parser.parse(`m.currentAssertLineNumber = ${callExpression.range.start.line + 1}`).ast.statements[0];
editor.arraySplice(owner, key, 0, leadingLine);
}
}
Expand Down Expand Up @@ -209,7 +209,7 @@ export class TestGroup extends TestBlock {
isSolo: ${this.isSolo}
isIgnored: ${this.isIgnored}
filename: "${this.pkgPath}"
lineNumber: "${this.annotation.annotation.range.start.line}"
lineNumber: "${this.annotation.annotation.range.start.line + 1}"
setupFunctionName: "${this.setupFunctionName || ''}"
tearDownFunctionName: "${this.tearDownFunctionName || ''}"
beforeEachFunctionName: "${this.beforeEachFunctionName || ''}"
Expand Down
Loading

0 comments on commit c461df0

Please sign in to comment.