testing: fix setting states in a run with identical IDs not working

Fixes #131827
This commit is contained in:
Connor Peet
2021-08-30 12:22:33 -07:00
parent d1e4e27c3a
commit f3fbecd1cc
2 changed files with 42 additions and 19 deletions

View File

@@ -444,30 +444,26 @@ class TestRunTracker extends Disposable {
throw new InvalidTestItemError(test.id);
}
if (this.sharedTestIds.has(test.id)) {
if (this.sharedTestIds.has(TestId.fromExtHostTestItem(test, this.dto.controllerId).toString())) {
return;
}
const chain: ITestItem[] = [];
while (true) {
chain.unshift(Convert.TestItem.from(test as TestItemImpl));
if (this.sharedTestIds.has(test.id)) {
break;
}
this.sharedTestIds.add(test.id);
if (!test.parent) {
break;
}
test = test.parent;
}
const root = this.dto.colllection.root;
if (!this.sharedTestIds.has(root.id)) {
this.sharedTestIds.add(root.id);
chain.unshift(Convert.TestItem.from(root));
while (true) {
const converted = Convert.TestItem.from(test as TestItemImpl);
chain.unshift(converted);
if (this.sharedTestIds.has(converted.extId)) {
break;
}
this.sharedTestIds.add(converted.extId);
if (test === root) {
break;
}
test = test.parent || root;
}
this.proxy.$addTestsToRun(this.dto.controllerId, this.dto.id, chain);