mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 15:25:47 +01:00
testing: fixes if no document hierarchy is provided
This commit is contained in:
@@ -267,11 +267,8 @@ export class ExtHostTesting implements ExtHostTestingShape {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const internal = this.getInternalTestForReference(test);
|
this.flushCollectionDiffs();
|
||||||
if (internal) {
|
this.proxy.$updateTestStateInRun(req.runId, test.id, TestState.from(state));
|
||||||
this.flushCollectionDiffs();
|
|
||||||
this.proxy.$updateTestStateInRun(req.runId, internal.item.extId, TestState.from(state));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
tests: includeTests.map(t => TestItemFilteredWrapper.unwrap(t.actual)),
|
tests: includeTests.map(t => TestItemFilteredWrapper.unwrap(t.actual)),
|
||||||
exclude: excludeTests.map(([, t]) => TestItemFilteredWrapper.unwrap(t.actual)),
|
exclude: excludeTests.map(([, t]) => TestItemFilteredWrapper.unwrap(t.actual)),
|
||||||
@@ -331,6 +328,14 @@ export class ExtHostTesting implements ExtHostTestingShape {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onDidInvalidateTest = new Emitter<vscode.TestItem>();
|
||||||
|
workspaceHierarchy.onDidInvalidateTest?.(node => {
|
||||||
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(node, document);
|
||||||
|
if (wrapper.hasNodeMatchingFilter) {
|
||||||
|
onDidInvalidateTest.fire(wrapper);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const onDidChangeTest = new Emitter<vscode.TestItem>();
|
const onDidChangeTest = new Emitter<vscode.TestItem>();
|
||||||
workspaceHierarchy.onDidChangeTest(node => {
|
workspaceHierarchy.onDidChangeTest(node => {
|
||||||
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(node, document);
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(node, document);
|
||||||
@@ -373,6 +378,8 @@ export class ExtHostTesting implements ExtHostTestingShape {
|
|||||||
onDidChangeTest.dispose();
|
onDidChangeTest.dispose();
|
||||||
TestItemFilteredWrapper.removeFilter(document);
|
TestItemFilteredWrapper.removeFilter(document);
|
||||||
},
|
},
|
||||||
|
discoveredInitialTests: workspaceHierarchy.discoveredInitialTests,
|
||||||
|
onDidInvalidateTest: onDidInvalidateTest.event,
|
||||||
onDidChangeTest: onDidChangeTest.event
|
onDidChangeTest: onDidChangeTest.event
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,6 +271,13 @@ export class SingleUseTestCollection implements IDisposable {
|
|||||||
const deletedChildren = internal.previousChildren;
|
const deletedChildren = internal.previousChildren;
|
||||||
const currentChildren = new Set<string>();
|
const currentChildren = new Set<string>();
|
||||||
for (const child of actual.children) {
|
for (const child of actual.children) {
|
||||||
|
// If a child was recreated, delete the old object before calling
|
||||||
|
// addItem() anew.
|
||||||
|
const previous = this.testIdToInternal.object.get(child.id);
|
||||||
|
if (previous && previous.actual !== child) {
|
||||||
|
this.removeItembyId(child.id);
|
||||||
|
}
|
||||||
|
|
||||||
const c = this.addItem(child, providerId, internal.item.extId);
|
const c = this.addItem(child, providerId, internal.item.extId);
|
||||||
deletedChildren.delete(c.item.extId);
|
deletedChildren.delete(c.item.extId);
|
||||||
currentChildren.add(c.item.extId);
|
currentChildren.add(c.item.extId);
|
||||||
|
|||||||
Reference in New Issue
Block a user