import type { MockedModuleSerialized, ServerIdResolution, ServerMockResolution } from "@vitest/mocker"; import type { BirpcReturn } from "birpc"; import type { AfterSuiteRunMeta, BaselineData, BrowserTesterOptions, CancelReason, RunnerTestFile, SnapshotResult, RunnerTaskEventPack as TaskEventPack, RunnerTaskResultPack as TaskResultPack, TestArtifact, TestBenchmark, TestExecutionMethod, UserConsoleLog } from "vitest"; import type { MarkOptions } from "vitest/browser"; export interface WebSocketBrowserHandlers { resolveSnapshotPath: (testPath: string) => string; resolveSnapshotRawPath: (testPath: string, rawPath: string) => string; onUnhandledError: (error: unknown, type: string) => Promise; onQueued: (method: TestExecutionMethod, file: RunnerTestFile) => void; onCollected: (method: TestExecutionMethod, files: RunnerTestFile[]) => Promise; onTaskArtifactRecord: (testId: string, artifact: Artifact) => Promise; onTaskUpdate: (method: TestExecutionMethod, packs: TaskResultPack[], events: TaskEventPack[]) => void; onTestBenchmark: (testId: string, benchmark: TestBenchmark) => void; readBenchmarkResult: (relativePath: string) => Promise; writeBenchmarkResult: (relativePath: string, data: BaselineData) => Promise; onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void; onOrchestratorReady: () => void; cancelCurrentRun: (reason: CancelReason) => void; getCountOfFailedTests: () => number; readSnapshotFile: (id: string) => Promise; readSnapshotFileData: (id: string) => Promise | null>; saveSnapshotFile: (id: string, content: string) => Promise; removeSnapshotFile: (id: string) => Promise; sendLog: (method: TestExecutionMethod, log: UserConsoleLog) => void; snapshotSaved: (snapshot: SnapshotResult) => void; debug: (...args: string[]) => void; resolveId: (id: string, importer?: string) => Promise; triggerCommand: (sessionId: string, command: string, testPath: string | undefined, payload: unknown[]) => Promise; resolveMock: (id: string, importer: string, options: { mock: "spy" | "factory" | "auto"; }) => Promise; invalidate: (ids: string[]) => void; getBrowserFileSourceMap: (id: string) => SourceMap | null | { mappings: ""; } | undefined; wdioSwitchContext: (direction: "iframe" | "parent") => void; registerMock: (sessionId: string, mock: MockedModuleSerialized) => void; unregisterMock: (sessionId: string, id: string) => void; clearMocks: (sessionId: string) => void; sendCdpEvent: (sessionId: string, event: string, payload?: Record) => unknown; trackCdpEvent: (sessionId: string, type: "on" | "once" | "off", event: string, listenerId: string) => void; } export interface WebSocketBrowserEvents { onCancel: (reason: CancelReason) => void; createTesters: (options: BrowserTesterOptions) => Promise; cleanupTesters: () => Promise; cdpEvent: (event: string, payload: unknown) => void; pageMark: (name: string, options?: MarkOptions) => Promise; resolveManualMock: (url: string) => Promise<{ url: string; keys: string[]; responseId: string; }>; } export type WebSocketBrowserRPC = BirpcReturn; interface SourceMap { file: string; mappings: string; names: string[]; sources: string[]; sourcesContent?: string[]; version: number; toString: () => string; toUrl: () => string; } export {};