import { IRPCProtocol } from '@opensumi/ide-connection/lib/common/rpc/multiplexer'; import { CancellationToken, Disposable, Emitter, Event } from '@opensumi/ide-core-common'; import { AbstractIncrementalTestCollection, ISerializedTestResults, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, RunTestForControllerRequest, TestsDiff } from '@opensumi/ide-testing/lib/common/testCollection'; import { TestRunProfileKind, TestRunRequest } from '../../../common/vscode/ext-types'; import { SingleUseTestCollection } from '../../../common/vscode/testing/testCollection'; import { IExtHostTests, IMainThreadTesting } from '../../../common/vscode/tests'; import type vscode from 'vscode'; type DefaultProfileChangeEvent = Map>; export declare class ExtHostTestsImpl extends Disposable implements IExtHostTests { protected rpcProtocol: IRPCProtocol; private readonly resultsChangedEmitter; private controllers; private readonly proxy; private readonly runTracker; private readonly observer; private readonly defaultProfilesChangedEmitter; private readonly debug; onResultsChanged: Event; results: ReadonlyArray; constructor(rpcProtocol: IRPCProtocol); $runControllerTests(req: RunTestForControllerRequest, token: CancellationToken): Promise; $cancelExtensionTestRun(runId: string | undefined): void; $acceptDiff(diff: TestsDiff): void; $publishTestResults(results: ISerializedTestResults[]): void; $expandTest(testId: string, levels: number): Promise; $configureRunProfile(controllerId: string, profileId: number): void; $refreshTests(controllerId: string, token: CancellationToken): Promise; createTestController(controllerId: string, label: string, refreshHandler?: (token: CancellationToken) => Thenable | void): vscode.TestController; } export declare class TestRunDto { readonly controllerId: string; readonly id: string; readonly isPersisted: boolean; readonly colllection: SingleUseTestCollection; private readonly includePrefix; private readonly excludePrefix; static fromPublic(controllerId: string, collection: SingleUseTestCollection, request: TestRunRequest, persist: boolean): TestRunDto; static fromInternal(request: RunTestForControllerRequest, collection: SingleUseTestCollection): TestRunDto; constructor(controllerId: string, id: string, include: string[], exclude: string[], isPersisted: boolean, colllection: SingleUseTestCollection); isIncluded(test: vscode.TestItem): boolean; } declare class TestRunTracker extends Disposable { private readonly dto; private readonly proxy; private readonly profile; private state; private running; private readonly tasks; private readonly sharedTestIds; private readonly cts; private readonly endEmitter; private readonly onDidDispose; private readonly publishedCoverage; /** * Fires when a test ends, and no more tests are left running. */ readonly onEnd: Event; /** * Gets whether there are any tests running. */ get isRunning(): boolean; /** * Gets the run ID. */ get id(): string; constructor(dto: TestRunDto, proxy: IMainThreadTesting, profile: vscode.TestRunProfile | undefined, parentToken?: CancellationToken); /** Gets the task ID from a test run object. */ getTaskIdForRun(run: vscode.TestRun): string | undefined; /** Requests cancellation of the run. On the second call, forces cancellation. */ cancel(taskId?: string): void; /** Gets details for a previously-emitted coverage object. */ getCoverageDetails(id: string, testId: string | undefined, token: CancellationToken): Promise; createRun(name: string | undefined): vscode.TestRun; private forciblyEndTasks; private markEnded; dispose(): void; private ensureTestIsKnown; } /** * Queues runs for a single extension and provides the currently-executing * run so that `createTestRun` can be properly correlated. */ export declare class TestRunCoordinator { private readonly proxy; private tracked; get trackers(): MapIterator; constructor(proxy: IMainThreadTesting); /** * Registers a request as being invoked by the main thread, so * `$startedExtensionTestRun` is not invoked. The run must eventually * be cancelled manually. */ prepareForMainThreadTestRun(req: TestRunRequest, dto: TestRunDto, profile: vscode.TestRunProfile, token: CancellationToken): TestRunTracker; /** * Cancels an existing test run via its cancellation token. */ cancelRunById(runId: string): void; /** * Cancels an existing test run via its cancellation token. */ cancelAllRuns(): void; /** * Implements the public `createTestRun` API. */ createTestRun(controllerId: string, collection: SingleUseTestCollection, request: TestRunRequest, name: string | undefined, persist: boolean): vscode.TestRun; private getTracker; } interface MirroredCollectionTestItem extends IncrementalTestCollectionItem { revived: vscode.TestItem; depth: number; } declare class MirroredChangeCollector extends IncrementalChangeCollector { private readonly emitter; private readonly added; private readonly updated; private readonly removed; private readonly alreadyRemoved; get isEmpty(): boolean; constructor(emitter: Emitter); /** * @override */ add(node: MirroredCollectionTestItem): void; /** * @override */ update(node: MirroredCollectionTestItem): void; /** * @override */ remove(node: MirroredCollectionTestItem): void; /** * @override */ getChangeEvent(): vscode.TestsChangeEvent; complete(): void; } /** * Maintains tests in this extension host sent from the main thread. * @private */ export declare class MirroredTestCollection extends AbstractIncrementalTestCollection { private changeEmitter; /** * Change emitter that fires with the same sematics as `TestObserver.onDidChangeTests`. */ readonly onDidChangeTests: Event; /** * Gets a list of root test items. */ get rootTests(): Set; /** * * If the test ID exists, returns its underlying ID. */ getMirroredTestDataById(itemId: string): MirroredCollectionTestItem | undefined; /** * If the test item is a mirrored test item, returns its underlying ID. */ getMirroredTestDataByReference(item: vscode.TestItem): MirroredCollectionTestItem | undefined; /** * @override */ protected createItem(item: InternalTestItem, parent?: MirroredCollectionTestItem): MirroredCollectionTestItem; /** * @override */ protected createChangeCollector(): MirroredChangeCollector; } export declare class TestRunProfileImpl implements vscode.TestRunProfile { #private; readonly controllerId: string; readonly profileId: number; private _label; readonly kind: TestRunProfileKind; runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void; _tag: vscode.TestTag | undefined; private _supportsContinuousRun; private _configureHandler?; get label(): string; set label(label: string); get supportsContinuousRun(): boolean; set supportsContinuousRun(supports: boolean); get isDefault(): boolean; set isDefault(isDefault: boolean); get tag(): vscode.TestTag | undefined; set tag(tag: vscode.TestTag | undefined); get configureHandler(): undefined | (() => void); set configureHandler(handler: undefined | (() => void)); get onDidChangeDefault(): Event; constructor(proxy: IMainThreadTesting, profiles: Map, activeProfiles: Set, onDidChangeActiveProfiles: Event, controllerId: string, profileId: number, _label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void, _isDefault?: boolean, _tag?: vscode.TestTag | undefined, _supportsContinuousRun?: boolean); dispose(): void; } export {}; //# sourceMappingURL=ext.host.tests.d.ts.map