import * as theia from '@theia/plugin';
import { CancellationToken } from '@theia/core/lib/common/cancellation';
import { Event } from '@theia/core';
import { TestingExt, TestingMain } from '../common/plugin-api-rpc';
import { CommandRegistryImpl } from './command-registry';
import { RPCProtocol } from '../common/rpc-protocol';
import { TestItemImpl, TestItemCollection } from './test-item';
import { TreeDelta } from '@theia/test/lib/common/tree-delta';
import { TestItemDTO, TestRunProfileDTO, TestRunProfileKind, TestRunRequestDTO, TestItemReference, TestMessageArg, TestMessageDTO } from '../common/test-types';
declare type RefreshHandler = (token: theia.CancellationToken) => void | theia.Thenable<void>;
declare type ResolveHandler = (item: theia.TestItem | undefined) => theia.Thenable<void> | void;
export declare class TestControllerImpl implements theia.TestController {
    private onDispose;
    protected readonly proxy: TestingMain;
    readonly id: string;
    private _label;
    protected readonly _profiles: Map<number, TestRunProfile>;
    private activeRuns;
    private deltaBuilder;
    private _refreshHandler?;
    private _resolveHandler?;
    constructor(onDispose: () => void, proxy: TestingMain, id: string, _label: string);
    mapDeltas(deltas: TreeDelta<string, TestItemImpl>[]): TreeDelta<string, TestItemDTO>[];
    mapDelta(delta: TreeDelta<string, TestItemImpl>): TreeDelta<string, TestItemDTO>;
    readonly items: TestItemCollection;
    get label(): string;
    set label(value: string);
    get refreshHandler(): RefreshHandler | undefined;
    set refreshHandler(value: RefreshHandler | undefined);
    get resolveHandler(): ResolveHandler | undefined;
    set resolveHandler(handler: ResolveHandler | undefined);
    getProfile(id: string): TestRunProfile | undefined;
    createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: theia.TestRunRequest, token: CancellationToken) => Thenable<void> | void, isDefault?: boolean, tag?: theia.TestTag, supportsContinuousRun?: boolean): theia.TestRunProfile;
    createTestItem(id: string, label: string, uri?: theia.Uri): theia.TestItem;
    createTestRun(request: theia.TestRunRequest, name?: string, persist?: boolean): theia.TestRun;
    dispose(): void;
    protected testRunStarted(request: theia.TestRunRequest, name: string, persist: boolean, isRunning: boolean): TestRun;
    runTestsForUI(profileId: string, name: string, includedTests: string[][], excludedTests: string[][]): void;
    cancelRun(runId?: string): void;
    invalidateTestResults(items?: theia.TestItem | readonly theia.TestItem[] | undefined): void;
}
declare class TestRun implements theia.TestRun {
    private readonly controller;
    private readonly proxy;
    readonly name: string;
    readonly isPersisted: boolean;
    private onDidEndEmitter;
    onDidEnd: Event<void>;
    private onWillFlushEmitter;
    onWillFlush: Event<void>;
    readonly id: string;
    private testStateDeltas;
    private testOutputDeltas;
    private changeBatcher;
    private ended;
    private tokenSource;
    readonly token: CancellationToken;
    constructor(controller: TestControllerImpl, proxy: TestingMain, name: string, isPersisted: boolean, isRunning: boolean);
    enqueued(test: theia.TestItem): void;
    started(test: theia.TestItem): void;
    skipped(test: theia.TestItem): void;
    failed(test: theia.TestItem, message: theia.TestMessage | readonly theia.TestMessage[], duration?: number | undefined): void;
    errored(test: theia.TestItem, message: theia.TestMessage | readonly theia.TestMessage[], duration?: number | undefined): void;
    passed(test: theia.TestItem, duration?: number | undefined): void;
    appendOutput(output: string, location?: theia.Location | undefined, test?: theia.TestItem | undefined): void;
    end(): void;
    private checkNotEnded;
    private updateTestState;
    emitChange(): void;
    cancel(): void;
}
export declare class TestingExtImpl implements TestingExt {
    private readonly controllersById;
    private readonly proxy;
    constructor(rpc: RPCProtocol, commands: CommandRegistryImpl);
    fromTestMessageArg(arg: TestMessageArg): {
        test?: theia.TestItem;
        message: theia.TestMessage;
    };
    toTestMessage(testMessage: TestMessageDTO): theia.TestMessage;
    toTestItem(ref: TestItemReference): theia.TestItem;
    protected withController(controllerId: string): TestControllerImpl;
    $onResolveChildren(controllerId: string, path: string[]): void;
    /**
     * Implements theia.test.registerTestProvider
     */
    createTestController(controllerId: string, label: string): theia.TestController;
    /** @inheritdoc */
    $onConfigureRunProfile(controllerId: string, profileId: string): void;
    /** @inheritdoc */
    $onDidChangeDefault(controllerId: string, profileId: string, isDefault: boolean): void;
    /** @inheritdoc */
    $refreshTests(controllerId: string, token: CancellationToken): Promise<void>;
    /**
     * Runs tests with the given set of IDs. Allows for test from multiple
     * providers to be run.
     * @override
     */
    $onRunControllerTests(reqs: TestRunRequestDTO[]): void;
    runTestsForUI(req: TestRunRequestDTO): void;
    /**
     * Cancels an ongoing test run.
     */
    $onCancelTestRun(controllerId: string, runId: string): void;
}
export declare class TestRunProfile implements theia.TestRunProfile {
    readonly controllerId: string;
    readonly profileId: string;
    readonly kind: theia.TestRunProfileKind;
    runHandler: (request: theia.TestRunRequest, token: theia.CancellationToken) => Thenable<void> | void;
    private readonly proxy;
    supportsContinuousRun: boolean;
    constructor(proxy: TestingMain, controllerId: string, profileId: string, label: string, kind: theia.TestRunProfileKind, runHandler: (request: theia.TestRunRequest, token: theia.CancellationToken) => Thenable<void> | void, isDefault?: boolean, tag?: theia.TestTag | undefined);
    protected notifyPropertyChange(property: keyof TestRunProfileDTO, value: any): void;
    label: string;
    _isDefault: boolean;
    get isDefault(): boolean;
    set isDefault(isDefault: boolean);
    doSetDefault(isDefault: boolean): boolean;
    private onDidChangeDefaultEmitter;
    onDidChangeDefault: Event<boolean>;
    tag: theia.TestTag | undefined;
    protected notifyTagChange(_property: keyof TestRunProfileDTO, value?: theia.TestTag): void;
    configureHandler: () => void | undefined;
    protected notifyConfigureHandlerChange(_property: keyof TestRunProfileDTO, value?: () => void): void;
    dispose(): void;
}
export {};
//# sourceMappingURL=tests.d.ts.map