Skip to content

Commit

Permalink
Started working on a fix onlys not being applied correctly when mixed…
Browse files Browse the repository at this point in the history
… with suites, groups, and tests
  • Loading branch information
chrisdp committed Jan 20, 2025
1 parent df78254 commit ec1b863
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions bsc-plugin/src/lib/rooibos/RooibosSessionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ export class SessionInfo {

this.addTestSuiteToPath(testSuite);
if (testSuite.isSolo) {
this.hasSoloSuites = !this.hasSoloGroups && !this.hasSoloTests;
this.hasSoloSuites = true;
}
if (testSuite.hasSoloGroups) {
this.hasSoloGroups = !this.hasSoloTests;
this.hasSoloGroups = true;
}
if (testSuite.hasSoloTests) {
this.hasSoloTests = true;
this.hasSoloGroups = false;
this.hasSoloSuites = false;
}
} else {
this.allTestSuites.add(testSuite);
Expand All @@ -72,17 +70,22 @@ export class SessionInfo {
for (let testSuite of [...this.testSuites.values()]) {
if (this.isExcludedByTag(testSuite, false)) {
testSuite.isIncluded = false;
} else if (this.hasSoloTests && !testSuite.hasSoloTests) {
testSuite.isIncluded = false;
} else if (this.hasSoloSuites && !testSuite.isSolo) {
testSuite.isIncluded = false;
} else if (testSuite.isIgnored) {
testSuite.isIncluded = true;
this.ignoredTestNames.push(testSuite.name + ' [WHOLE SUITE]');
this.ignoredCount++;
}

if (!testSuite.isIgnored) {
if (this.hasSoloTests || this.hasSoloGroups || this.hasSoloSuites) {
if (testSuite.isSolo || testSuite.hasSoloGroups || testSuite.hasSoloTests) {
testSuite.isIncluded = true;
}
}
} else {
testSuite.isIncluded = true;
if (!this.hasSoloTests && this.hasSoloGroups && this.hasSoloSuites) {
testSuite.isIncluded = true;
this.ignoredTestNames.push(testSuite.name + ' [WHOLE SUITE]');
this.ignoredCount++;
}
}

if (!testSuite.isIncluded) {
continue;
}
Expand All @@ -92,13 +95,6 @@ export class SessionInfo {
testGroup.isIgnored = true;
}

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

if (testGroup.ignoredTestCases.length > 0) {
this.ignoredTestNames.push(testGroup.name);
this.ignoredCount += testGroup.ignoredTestCases.length;
Expand All @@ -114,13 +110,18 @@ export class SessionInfo {
}
}
}
if (this.isExcludedByTag(testGroup, true)) {
testGroup.isIncluded = false;
} else if (this.hasSoloTests && !testGroup.hasSoloTests) {
testGroup.isIncluded = false;
} else if (this.hasSoloGroups && !testGroup.isSolo) {
testGroup.isIncluded = false;

if (!testGroup.isIgnored && !this.isExcludedByTag(testGroup, true)) {
if (testSuite.isSolo || testSuite.hasSoloGroups || testSuite.hasSoloTests) {
if (testGroup.isSolo || testGroup.hasSoloTests) {
testGroup.isIncluded = true;
} else {
testGroup.isIncluded = testSuite.isSolo;
}
}
} else {
this.ignoredCount += testGroup.ignoredTestCases.length;
this.ignoredTestNames.push(testGroup.name + ' [WHOLE GROUP]');
testGroup.isIncluded = true;
}

Expand All @@ -129,6 +130,7 @@ export class SessionInfo {
let testCases = [...testGroup.testCases.values()];

for (let testCase of testCases) {
testCase.isIncluded = false;
if (testGroup.isIgnored) {
testCase.isIgnored = true;
}
Expand All @@ -137,10 +139,14 @@ export class SessionInfo {
testCase.isIncluded = false;
} else if (testCase.isIgnored) {
testCase.isIncluded = true;
} else if (this.hasSoloTests && !testCase.isSolo) {
} else if (testGroup.hasSoloTests && !testCase.isSolo) {
testCase.isIncluded = false;
} else {
testCase.isIncluded = testGroup.isIncluded || testCase.isSolo;
if (testGroup.hasSoloTests) {
testCase.isIncluded = testCase.isSolo;
} else {
testCase.isIncluded = testGroup.isIncluded || testCase.isSolo;
}
}
}

Expand Down

0 comments on commit ec1b863

Please # to comment.