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

Added the ability to have duplicate test names #317

Merged
merged 9 commits into from
Feb 24, 2025
Merged
2 changes: 1 addition & 1 deletion bsc-plugin/src/lib/rooibos/MockUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class MockUtil {
gatherGlobalMethodMocks(testSuite: TestSuite) {
// console.log('gathering global method mocks for testSuite', testSuite.name);
for (let group of [...testSuite.testGroups.values()].filter((tg) => tg.isIncluded)) {
for (let testCase of [...group.testCases.values()].filter((tc) => tc.isIncluded)) {
for (let testCase of [...group.testCases].filter((tc) => tc.isIncluded)) {
this.gatherMockedGlobalMethods(testSuite, testCase);
}
}
Expand Down
4 changes: 2 additions & 2 deletions bsc-plugin/src/lib/rooibos/RooibosSessionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ export class SessionInfo {
testGroup.isIncluded = true;
if (testGroup.isIgnored) {
this.ignoredTestNames.push(testGroup.name + ' [WHOLE GROUP]');
this.ignoredCount += testGroup.testCases.size;
this.ignoredCount += testGroup.testCases.length;
}
}

if (testGroup.isIncluded) {
if (testGroup.isIncluded) {
this.groupsCount++;
}
let testCases = [...testGroup.testCases.values()];
let testCases = [...testGroup.testCases];

for (let testCase of testCases) {
testCase.isIncluded = false;
Expand Down
10 changes: 3 additions & 7 deletions bsc-plugin/src/lib/rooibos/TestGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@ export class TestGroup extends TestBlock {
}

public testSuite: TestSuite;
public testCases = new Map<string, TestCase>();
public testCases: Array<TestCase> = [];

public addTestCase(testCase: TestCase) {
this.testCases.set(testCase.name + (testCase.isParamTest ? testCase.paramTestIndex.toString() : ''), testCase);
this.testCases.push(testCase);
this.hasIgnoredTests = this.hasIgnoredTests || testCase.isIgnored;
this.hasSoloTests = this.hasSoloTests || testCase.isSolo;
this.hasAsyncTests = this.hasAsyncTests || testCase.isAsync;
}

public getTestCases(): TestCase[] {
return [...this.testCases.values()];
}

public modifyAssertions(testCase: TestCase, noEarlyExit: boolean, editor: AstEditor, namespaceLookup: Map<string, NamespaceContainer>, scope: Scope) {
//for each method
//if assertion
Expand Down Expand Up @@ -201,7 +197,7 @@ export class TestGroup extends TestBlock {
}

public asText(): string {
let testCaseText = [...this.testCases.values()].filter((tc) => tc.isIncluded).map((tc) => tc.asText());
let testCaseText = [...this.testCases].filter((tc) => tc.isIncluded).map((tc) => tc.asText());

return `
{
Expand Down
1 change: 1 addition & 0 deletions bsc-plugin/src/lib/rooibos/TestSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class TestSuite extends TestBlock {
public hasSoloGroups = false;
public isNodeTest = false;
public session: RooibosSession;
public registeredTestCount = 0;

public addGroup(group: TestGroup) {
this.testGroups.set(group.name, group);
Expand Down
Loading