testing: fixes if no document hierarchy is provided

This commit is contained in:
Connor Peet
2021-02-22 15:23:02 -08:00
parent e4a082af7f
commit 9cd0f2e8a4
2 changed files with 19 additions and 5 deletions

View File

@@ -267,11 +267,8 @@ export class ExtHostTesting implements ExtHostTestingShape {
}
}
const internal = this.getInternalTestForReference(test);
if (internal) {
this.flushCollectionDiffs();
this.proxy.$updateTestStateInRun(req.runId, internal.item.extId, TestState.from(state));
}
this.flushCollectionDiffs();
this.proxy.$updateTestStateInRun(req.runId, test.id, TestState.from(state));
},
tests: includeTests.map(t => TestItemFilteredWrapper.unwrap(t.actual)),
exclude: excludeTests.map(([, t]) => TestItemFilteredWrapper.unwrap(t.actual)),
@@ -331,6 +328,14 @@ export class ExtHostTesting implements ExtHostTestingShape {
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>();
workspaceHierarchy.onDidChangeTest(node => {
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(node, document);
@@ -373,6 +378,8 @@ export class ExtHostTesting implements ExtHostTestingShape {
onDidChangeTest.dispose();
TestItemFilteredWrapper.removeFilter(document);
},
discoveredInitialTests: workspaceHierarchy.discoveredInitialTests,
onDidInvalidateTest: onDidInvalidateTest.event,
onDidChangeTest: onDidChangeTest.event
};
}