Skip to content

Commit

Permalink
Fixed some issues with skipped tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdp committed Jan 10, 2025
1 parent 9855d2d commit 707e01c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
13 changes: 10 additions & 3 deletions bsc-plugin/src/lib/rooibos/RooibosSessionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class SessionInfo {
} else if (this.hasSoloSuites && !testSuite.isSolo) {
testSuite.isIncluded = false;
} else if (testSuite.isIgnored) {
// testSuite.isIncluded = false;
testSuite.isIncluded = true;
this.ignoredTestNames.push(testSuite.name + ' [WHOLE SUITE]');
this.ignoredCount++;
} else {
Expand All @@ -88,12 +88,15 @@ export class SessionInfo {
}
//'testSuite ' + testSuite.name);
for (let testGroup of testSuite.getTestGroups()) {
if (testSuite.isIgnored) {
testGroup.isIgnored = true;
}

//'GROUP ' + testGroup.name);
if (testGroup.isIgnored) {
this.ignoredCount += testGroup.ignoredTestCases.length;
this.ignoredTestNames.push(testGroup.name + ' [WHOLE GROUP]');
testGroup.isIncluded = false;
testGroup.isIncluded = true;
}

if (testGroup.ignoredTestCases.length > 0) {
Expand Down Expand Up @@ -126,10 +129,14 @@ export class SessionInfo {
let testCases = [...testGroup.testCases.values()];

for (let testCase of testCases) {
if (testGroup.isIgnored) {
testCase.isIgnored = true;
}

if (this.isExcludedByTag(testCase, true)) {
testCase.isIncluded = false;
} else if (testCase.isIgnored) {
testCase.isIncluded = false;
testCase.isIncluded = true;
} else if (this.hasSoloTests && !testCase.isSolo) {
testCase.isIncluded = false;
} else {
Expand Down
5 changes: 2 additions & 3 deletions bsc-plugin/src/lib/rooibos/TestGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ export class TestGroup extends TestBlock {
if (testCase.isIgnored) {
this.ignoredTestCases.push(testCase);
this.hasIgnoredTests = true;
}

if (testCase.isSolo) {
this.soloTestCases.push(testCase);
} else if (testCase.isSolo) {
this.hasSoloTests = true;
this.soloTestCases.push(testCase);
this.hasAsyncTests = testCase.isAsync;
Expand Down
4 changes: 4 additions & 0 deletions bsc-plugin/src/lib/rooibos/TestSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export class TestBlock {
return this.annotation.isIgnore;
}

public set isIgnored(value: boolean) {
this.annotation.isIgnore = value;
}

public isValid = false;
public isIncluded = false;

Expand Down
18 changes: 17 additions & 1 deletion framework/src/source/TestGroup.bs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ namespace rooibos
test = new rooibos.Test(m, testData)
m.tests.push(test)

if test.isIgnored
m.notifyReportersOnTestBegin(test)
m.testSuite.runTest(test)
m.notifyReportersOnTestComplete(test)
m.stats.appendTestResult(test.result)
continue for
end if

isOk = m.runSuiteFunction(m.beforeEachFunctionName, "beforeEach", test)

if isOk
Expand Down Expand Up @@ -135,11 +143,19 @@ namespace rooibos
'finished
m.finishAsyncTests()
else
test = m.currentTest
if test.isIgnored
m.notifyReportersOnTestBegin(test)
m.testSuite.runTest(test)
m.testRunner.top.rooibosTestFinished = true
m.onAsyncTestComplete()
return invalid
end if

m.testRunner.top.rooibosTestFinished = false
isOk = m.runSuiteFunction(m.beforeEachFunctionName, "beforeEach", m.currentTest)
if isOk
'TODO - set a timeout here
test = m.currentTest
if test.isAsync <> true
? "Executing test synchronously"
m.notifyReportersOnTestBegin(test)
Expand Down

0 comments on commit 707e01c

Please sign in to comment.