import { TestProject, ResolvedConfig, BrowserServerFactory, BrowserCommand, BrowserProviderOption } from 'vitest/node'; import { ScreenshotMatcherOptions, NonStandardScreenshotComparators, ScreenshotComparatorRegistry } from '@vitest/browser/context'; interface BaseMetadata { height: number; width: number; } type TypedArray = Buffer | Uint8Array | Uint8ClampedArray; type Promisable = T | Promise; type Comparator> = (reference: { metadata: BaseMetadata; data: TypedArray; }, actual: { metadata: BaseMetadata; data: TypedArray; }, options: { /** * Allows the comparator to create a diff image. * * Note that the comparator might choose to ignore the flag, so a diff image is not guaranteed. */ createDiff: boolean; } & Options) => Promisable<{ pass: boolean; diff: TypedArray | null; message: string | null; }>; type CustomComparatorsToRegister = { [Key in keyof NonStandardScreenshotComparators]: Comparator }; type CustomComparatorsRegistry = keyof CustomComparatorsToRegister extends never ? { comparators?: Record>>; } : { comparators: CustomComparatorsToRegister; }; declare module "vitest/node" { interface ToMatchScreenshotOptions extends Omit, CustomComparatorsRegistry {} interface ToMatchScreenshotComparators extends ScreenshotComparatorRegistry {} } declare enum DOM_KEY_LOCATION { STANDARD = 0, LEFT = 1, RIGHT = 2, NUMPAD = 3 } interface keyboardKey { /** Physical location on a keyboard */ code?: string; /** Character or functional key descriptor */ key?: string; /** Location on the keyboard for keys with multiple representation */ location?: DOM_KEY_LOCATION; /** Does the character in `key` require/imply AltRight to be pressed? */ altGr?: boolean; /** Does the character in `key` require/imply a shiftKey to be pressed? */ shift?: boolean; } declare function parseKeyDef(text: string): { keyDef: keyboardKey; releasePrevious: boolean; releaseSelf: boolean; repeat: number; }[]; declare function resolveScreenshotPath(testPath: string, name: string, config: ResolvedConfig, customPath: string | undefined): string; declare function assertBrowserFileAccess(project: TestProject, path: string): void; declare function assertBrowserApiWrite(project: TestProject, path: string): void; interface SerializedLocator { selector: string; locator: string; } declare function defineBrowserCommand(fn: BrowserCommand): BrowserCommand; /** * The browser provider's `serverFactory`. Returns a `BrowserServerContribution` * that Vitest core uses to build the SINGLE Vite server shared by `project.vite` * and `project.browser.vite`. This factory does NOT create a server (core does); * it only contributes config, plugins, the parent factory, and the RPC setup. */ declare const createBrowserServer: BrowserServerFactory; declare function defineBrowserProvider(options: Omit, "serverFactory" | "options"> & { options?: T; }): BrowserProviderOption; export { assertBrowserApiWrite, assertBrowserFileAccess, createBrowserServer, defineBrowserCommand, defineBrowserProvider, parseKeyDef, resolveScreenshotPath }; export type { CustomComparatorsRegistry, SerializedLocator };