testing: initial api side of test coverage

For https://github.com/microsoft/vscode/issues/123713
This commit is contained in:
Connor Peet
2021-06-25 12:58:04 -07:00
parent cf9635a547
commit 45eea1f87b
10 changed files with 596 additions and 19 deletions

View File

@@ -11,7 +11,9 @@ import { URI } from 'vs/base/common/uri';
import { Range } from 'vs/editor/common/core/range';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { TestResultState } from 'vs/workbench/api/common/extHostTypes';
import { MutableObservableValue } from 'vs/workbench/contrib/testing/common/observableValue';
import { ExtensionRunTestsRequest, ITestItem, ITestMessage, ITestRunTask, RunTestsRequest, TestDiffOpType, TestsDiff } from 'vs/workbench/contrib/testing/common/testCollection';
import { TestCoverage } from 'vs/workbench/contrib/testing/common/testCoverage';
import { LiveTestResult } from 'vs/workbench/contrib/testing/common/testResult';
import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
import { ITestRootProvider, ITestService } from 'vs/workbench/contrib/testing/common/testService';
@@ -78,6 +80,23 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
this.withLiveRun(runId, r => r.addTestChainToRun(controllerId, tests));
}
/**
* @inheritdoc
*/
$signalCoverageAvailable(runId: string, taskId: string): void {
this.withLiveRun(runId, run => {
const task = run.tasks.find(t => t.id === taskId);
if (!task) {
return;
}
(task.coverage as MutableObservableValue<TestCoverage>).value = new TestCoverage({
provideFileCoverage: token => this.proxy.$provideFileCoverage(runId, taskId, token),
resolveFileCoverage: (i, token) => this.proxy.$resolveFileCoverage(runId, taskId, i, token),
});
});
}
/**
* @inheritdoc
*/