import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { Position } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/position"; import { Location } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages"; import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service"; import { TestId } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/testing/common/testId"; import { ITestService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/testing/common/testService.service"; import { AbstractIncrementalTestCollection, ICallProfileRunHandler, IncrementalTestCollectionItem, InternalTestItem, IStartControllerTests, IStartControllerTestsResult, ITestItemContext, TestControllerCapability, TestMessageFollowupRequest, TestMessageFollowupResponse, TestRunProfileBitset, TestsDiff } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/testing/common/testTypes"; export interface IMainThreadTestController { readonly id: string; readonly label: IObservable; readonly capabilities: IObservable; syncTests(token: CancellationToken): Promise; refreshTests(token: CancellationToken): Promise; configureRunProfile(profileId: number): void; expandTest(id: string, levels: number): Promise; getRelatedCode(testId: string, token: CancellationToken): Promise; startContinuousRun(request: ICallProfileRunHandler[], token: CancellationToken): Promise; runTests(request: IStartControllerTests[], token: CancellationToken): Promise; } export interface IMainThreadTestHostProxy { provideTestFollowups(req: TestMessageFollowupRequest, token: CancellationToken): Promise; getTestsRelatedToCode(uri: URI, position: Position, token: CancellationToken): Promise; executeTestFollowup(id: number): Promise; disposeTestFollowups(ids: number[]): void; } export interface IMainThreadTestCollection extends AbstractIncrementalTestCollection { readonly onBusyProvidersChange: Event; /** * Number of providers working to discover tests. */ busyProviders: number; /** * Root item IDs. */ rootIds: Iterable; /** * Root items, correspond to registered controllers. */ rootItems: Iterable; /** * Iterates over every test in the collection, in strictly descending * order of depth. */ all: Iterable; /** * Gets a node in the collection by ID. */ getNodeById(id: string): IncrementalTestCollectionItem | undefined; /** * Gets all tests that have the given URL. Tests returned from this * method are *not* in any particular order. */ getNodeByUrl(uri: URI): Iterable; /** * Requests that children be revealed for the given test. "Levels" may * be infinite. */ expand(testId: string, levels: number): Promise; /** * Gets a diff that adds all items currently in the tree to a new collection, * allowing it to fully hydrate. */ getReviverDiff(): TestsDiff; } export declare const testCollectionIsEmpty: (collection: IMainThreadTestCollection) => boolean; export declare const getContextForTestItem: (collection: IMainThreadTestCollection, id: string | TestId) => ITestItemContext | { controller: string; }; /** * Ensures the test with the given ID exists in the collection, if possible. * If cancellation is requested, or the test cannot be found, it will return * undefined. */ export declare const expandAndGetTestById: (collection: IMainThreadTestCollection, id: string, ct?: Readonly) => Promise; /** * Waits for the test to no longer be in the "busy" state. */ export declare const waitForTestToBeIdle: (testService: ITestService, test: IncrementalTestCollectionItem) => Promise | undefined; /** * Iterator that expands to and iterates through tests in the file. Iterates * in strictly descending order. */ export declare const testsInFile: (testService: ITestService, ident: IUriIdentityService, uri: URI, waitForIdle?: boolean, descendInFile?: boolean) => AsyncIterable; /** * Iterator that iterates to the top-level children of tests under the given * the URI. */ export declare const testsUnderUri: (testService: ITestService, ident: IUriIdentityService, uri: URI, waitForIdle?: boolean) => AsyncIterable; /** * Simplifies the array of tests by preferring test item parents if all of * their children are included. */ export declare const simplifyTestsToExecute: (collection: IMainThreadTestCollection, tests: IncrementalTestCollectionItem[]) => IncrementalTestCollectionItem[]; /** * A run request that expresses the intent of the request and allows the * test service to resolve the specifics of the group. */ export interface AmbiguousRunTestsRequest { /** Group to run */ group: TestRunProfileBitset; /** Tests to run. Allowed to be from different controllers */ tests: readonly InternalTestItem[]; /** Tests to exclude. If not given, the current UI excluded tests are used */ exclude?: InternalTestItem[]; /** Whether this was triggered from an auto run. */ continuous?: boolean; /** Whether this was trigged by a user action in UI. Default=true */ preserveFocus?: boolean; } export interface ITestFollowup { message: string; execute(): Promise; } export interface ITestFollowups extends IDisposable { followups: ITestFollowup[]; }