Skip to content

Commit 08dd7d7

Browse files
committed
Fixup running parameterized tests a second time
1 parent 2aa8bbf commit 08dd7d7

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/TestExplorer/TestRunArguments.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import * as vscode from "vscode";
1616
import { reduceTestItemChildren } from "./TestUtils";
17+
import { TestRunProxy } from "./TestRunner";
1718

1819
type ProcessResult = {
1920
testItems: vscode.TestItem[];
@@ -93,7 +94,7 @@ export class TestRunArguments {
9394
const terminator = hasChildren ? "/" : "$";
9495
// Debugging XCTests requires exact matches, so we don't need a trailing terminator.
9596
return isDebug ? arg.id : `${arg.id}${terminator}`;
96-
} else if (hasChildren) {
97+
} else if (hasChildren && !this.hasParameterizedTestChildren(arg)) {
9798
// Append a trailing slash to match a suite name exactly.
9899
// This prevents TestTarget.MySuite matching TestTarget.MySuite2.
99100
return `${arg.id}/`;
@@ -102,6 +103,12 @@ export class TestRunArguments {
102103
});
103104
}
104105

106+
private hasParameterizedTestChildren(testItem: vscode.TestItem): boolean {
107+
return Array.from(testItem.children).some(arr =>
108+
arr[1].tags.some(tag => tag.id === TestRunProxy.Tags.PARAMETERIZED_TEST_RESULT)
109+
);
110+
}
111+
105112
private createTestItemReducer(
106113
include: readonly vscode.TestItem[],
107114
exclude: readonly vscode.TestItem[],

src/TestExplorer/TestRunner.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class TestRunProxy {
164164
// https://github.com/swiftlang/swift-testing/issues/671 is resolved.
165165
testClass.tags = compactMap(parent.tags, t =>
166166
t.id === runnableTag.id ? null : new vscode.TestTag(t.id)
167-
);
167+
).concat(new vscode.TestTag(TestRunProxy.Tags.PARAMETERIZED_TEST_RESULT));
168168

169169
const added = upsertTestItem(this.controller, testClass, parent);
170170

@@ -406,9 +406,10 @@ export class TestRunProxy {
406406
await this.coverage.computeCoverage(this.testRun);
407407
}
408408

409-
private static Tags = {
409+
static Tags = {
410410
SKIPPED: "skipped",
411411
HAS_ATTACHMENT: "hasAttachment",
412+
PARAMETERIZED_TEST_RESULT: "parameterizedTestResult",
412413
};
413414

414415
// Remove any tags that were added due to test results

0 commit comments

Comments
 (0)