diff --git a/src/vs/workbench/api/browser/mainThreadTesting.ts b/src/vs/workbench/api/browser/mainThreadTesting.ts index b440572b157..960f38b305e 100644 --- a/src/vs/workbench/api/browser/mainThreadTesting.ts +++ b/src/vs/workbench/api/browser/mainThreadTesting.ts @@ -37,7 +37,6 @@ const reviveDiff = (diff: TestsDiff) => { export class MainThreadTesting extends Disposable implements MainThreadTestingShape, ITestRootProvider { private readonly proxy: ExtHostTestingShape; private readonly diffListener = this._register(new MutableDisposable()); - private readonly testSubscriptions = new Map(); private readonly testProviderRegistrations = new Map(); constructor( @@ -205,10 +204,10 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh public override dispose() { super.dispose(); - for (const subscription of this.testSubscriptions.values()) { + for (const subscription of this.testProviderRegistrations.values()) { subscription.dispose(); } - this.testSubscriptions.clear(); + this.testProviderRegistrations.clear(); } private withLiveRun(runId: string, fn: (run: LiveTestResult) => T): T | undefined { diff --git a/src/vs/workbench/contrib/testing/common/testServiceImpl.ts b/src/vs/workbench/contrib/testing/common/testServiceImpl.ts index a9bf1a2ea8a..30f84c9db12 100644 --- a/src/vs/workbench/contrib/testing/common/testServiceImpl.ts +++ b/src/vs/workbench/contrib/testing/common/testServiceImpl.ts @@ -16,7 +16,7 @@ import { IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/work import { MainThreadTestCollection } from 'vs/workbench/contrib/testing/common/mainThreadTestCollection'; import { MutableObservableValue } from 'vs/workbench/contrib/testing/common/observableValue'; import { StoredValue } from 'vs/workbench/contrib/testing/common/storedValue'; -import { RunTestsRequest, ITestIdWithSrc, TestsDiff } from 'vs/workbench/contrib/testing/common/testCollection'; +import { RunTestsRequest, ITestIdWithSrc, TestsDiff, TestDiffOpType } from 'vs/workbench/contrib/testing/common/testCollection'; import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys'; import { ITestResult } from 'vs/workbench/contrib/testing/common/testResult'; import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService'; @@ -195,6 +195,15 @@ export class TestService extends Disposable implements ITestService { this.providerCount.set(this.testControllers.size); return toDisposable(() => { + const diff: TestsDiff = []; + for (const root of this.collection.rootItems) { + if (root.controllerId === id) { + diff.push([TestDiffOpType.Remove, root.item.extId]); + } + } + + this.publishDiff(id, diff); + if (this.testControllers.delete(id)) { this.providerCount.set(this.testControllers.size); }