mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
testing: disentangle test item collection from exthost for use in tests
Fixes #141921
This commit is contained in:
@@ -17,18 +17,18 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ExtHostTestingShape, ILocationDto, MainContext, MainThreadTestingShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { InvalidTestItemError, TestItemImpl, TestItemRootImpl } from 'vs/workbench/api/common/extHostTestingPrivateApi';
|
||||
import { ExtHostTestItemCollection, TestItemImpl, TestItemRootImpl } from 'vs/workbench/api/common/extHostTestingPrivateApi';
|
||||
import * as Convert from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
import { TestRunProfileKind, TestRunRequest } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { SingleUseTestCollection } from 'vs/workbench/contrib/testing/common/ownedTestCollection';
|
||||
import { AbstractIncrementalTestCollection, CoverageDetails, IFileCoverage, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, ISerializedTestResults, ITestItem, RunTestForControllerRequest, TestResultState, TestRunProfileBitset, TestsDiff, TestsDiffOp } from 'vs/workbench/contrib/testing/common/testCollection';
|
||||
import { AbstractIncrementalTestCollection, CoverageDetails, IFileCoverage, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, ISerializedTestResults, ITestItem, RunTestForControllerRequest, TestResultState, TestRunProfileBitset, TestsDiff, TestsDiffOp } from 'vs/workbench/contrib/testing/common/testTypes';
|
||||
import { TestId, TestIdPathParts, TestPosition } from 'vs/workbench/contrib/testing/common/testId';
|
||||
import { InvalidTestItemError } from 'vs/workbench/contrib/testing/common/testItemCollection';
|
||||
import type * as vscode from 'vscode';
|
||||
|
||||
interface ControllerInfo {
|
||||
controller: vscode.TestController;
|
||||
profiles: Map<number, vscode.TestRunProfile>;
|
||||
collection: SingleUseTestCollection;
|
||||
collection: ExtHostTestItemCollection;
|
||||
}
|
||||
|
||||
export class ExtHostTesting implements ExtHostTestingShape {
|
||||
@@ -61,7 +61,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
|
||||
}
|
||||
|
||||
const disposable = new DisposableStore();
|
||||
const collection = disposable.add(new SingleUseTestCollection(controllerId));
|
||||
const collection = disposable.add(new ExtHostTestItemCollection(controllerId, label));
|
||||
collection.root.label = label;
|
||||
|
||||
const profiles = new Map<number, vscode.TestRunProfile>();
|
||||
@@ -107,7 +107,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
|
||||
collection.resolveHandler = fn;
|
||||
},
|
||||
get resolveHandler() {
|
||||
return collection.resolveHandler;
|
||||
return collection.resolveHandler as undefined | ((item?: vscode.TestItem) => void);
|
||||
},
|
||||
dispose: () => {
|
||||
disposable.dispose();
|
||||
@@ -527,7 +527,7 @@ export class TestRunCoordinator {
|
||||
/**
|
||||
* Implements the public `createTestRun` API.
|
||||
*/
|
||||
public createTestRun(controllerId: string, collection: SingleUseTestCollection, request: vscode.TestRunRequest, name: string | undefined, persist: boolean): vscode.TestRun {
|
||||
public createTestRun(controllerId: string, collection: ExtHostTestItemCollection, request: vscode.TestRunRequest, name: string | undefined, persist: boolean): vscode.TestRun {
|
||||
const existing = this.tracked.get(request);
|
||||
if (existing) {
|
||||
return existing.createRun(name);
|
||||
@@ -575,7 +575,7 @@ export class TestRunDto {
|
||||
private readonly includePrefix: string[];
|
||||
private readonly excludePrefix: string[];
|
||||
|
||||
public static fromPublic(controllerId: string, collection: SingleUseTestCollection, request: vscode.TestRunRequest, persist: boolean) {
|
||||
public static fromPublic(controllerId: string, collection: ExtHostTestItemCollection, request: vscode.TestRunRequest, persist: boolean) {
|
||||
return new TestRunDto(
|
||||
controllerId,
|
||||
generateUuid(),
|
||||
@@ -586,7 +586,7 @@ export class TestRunDto {
|
||||
);
|
||||
}
|
||||
|
||||
public static fromInternal(request: RunTestForControllerRequest, collection: SingleUseTestCollection) {
|
||||
public static fromInternal(request: RunTestForControllerRequest, collection: ExtHostTestItemCollection) {
|
||||
return new TestRunDto(
|
||||
request.controllerId,
|
||||
request.runId,
|
||||
@@ -603,7 +603,7 @@ export class TestRunDto {
|
||||
include: string[],
|
||||
exclude: string[],
|
||||
public readonly isPersisted: boolean,
|
||||
public readonly colllection: SingleUseTestCollection,
|
||||
public readonly colllection: ExtHostTestItemCollection,
|
||||
) {
|
||||
this.includePrefix = include.map(id => id + TestIdPathParts.Delimiter);
|
||||
this.excludePrefix = exclude.map(id => id + TestIdPathParts.Delimiter);
|
||||
@@ -966,3 +966,4 @@ const profileGroupToBitset: { [K in TestRunProfileKind]: TestRunProfileBitset }
|
||||
[TestRunProfileKind.Debug]: TestRunProfileBitset.Debug,
|
||||
[TestRunProfileKind.Run]: TestRunProfileBitset.Run,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user