Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import 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<void> onQueued: (method: TestExecutionMethod, file: RunnerTestFile) => void onCollected: (method: TestExecutionMethod, files: RunnerTestFile[]) => Promise<void> onTaskArtifactRecord: <Artifact extends TestArtifact>( testId: string, artifact: Artifact, ) => Promise<Artifact> onTaskUpdate: ( method: TestExecutionMethod, packs: TaskResultPack[], events: TaskEventPack[], ) => void onTestBenchmark: (testId: string, benchmark: TestBenchmark) => void readBenchmarkResult: (relativePath: string) => Promise<BaselineData | null> writeBenchmarkResult: (relativePath: string, data: BaselineData) => Promise<void> onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void onOrchestratorReady: () => void cancelCurrentRun: (reason: CancelReason) => void getCountOfFailedTests: () => number readSnapshotFile: (id: string) => Promise<string | null> readSnapshotFileData: (id: string) => Promise<Record<string, string> | null> saveSnapshotFile: (id: string, content: string) => Promise<void> removeSnapshotFile: (id: string) => Promise<void> sendLog: (method: TestExecutionMethod, log: UserConsoleLog) => void snapshotSaved: (snapshot: SnapshotResult) => void debug: (...args: string[]) => void resolveId: (id: string, importer?: string) => Promise<ServerIdResolution | null> triggerCommand: <T>( sessionId: string, command: string, testPath: string | undefined, payload: unknown[], ) => Promise<T> resolveMock: ( id: string, importer: string, options: { mock: 'spy' | 'factory' | 'auto' }, ) => Promise<ServerMockResolution> 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
// cdp sendCdpEvent: (sessionId: string, event: string, payload?: Record<string, unknown>) => unknown trackCdpEvent: ( sessionId: string, type: 'on' | 'once' | 'off', event: string, listenerId: string, ) => void}
export interface WebSocketBrowserEvents { onCancel: (reason: CancelReason) => void createTesters: (options: BrowserTesterOptions) => Promise<void> cleanupTesters: () => Promise<void> cdpEvent: (event: string, payload: unknown) => void pageMark: (name: string, options?: MarkOptions) => Promise<void> resolveManualMock: (url: string) => Promise<{ url: string keys: string[] responseId: string }>}
export type WebSocketBrowserRPC = BirpcReturn<WebSocketBrowserEvents, WebSocketBrowserHandlers>
interface SourceMap { file: string mappings: string names: string[] sources: string[] sourcesContent?: string[] version: number toString: () => string toUrl: () => string}