@lewiswright/vitest-plugin-vis
Version:
Vitest visual testing plugin
75 lines • 3.52 kB
TypeScript
import type { VisOptions } from '../config/types.ts';
import type { PartialBrowserCommandContext, VisProjectState } from './vis_context.types.ts';
export declare function createVisContext(): {
setOptions<M extends "pixel" | "ssim">(projectName: string | undefined, options?: VisOptions<M>): void;
__test__getOptions(projectName: string): VisOptions<any> | undefined;
__test__reset(): void;
__test__getState(context: PartialBrowserCommandContext): Promise<VisProjectState>;
/**
* Setup suite is called on each test file's beforeAll hook.
* Test files include vitest test files and storybook story files.
* It needs to make sure there is no race condition between the test files.
*/
setupSuite(browserContext: PartialBrowserCommandContext): Promise<import("type-plus").Pick._<VisProjectState, "subjectDataTestId">>;
getSnapshotInfo(browserContext: PartialBrowserCommandContext, name: string, isAutoSnapshot: boolean, options?: {
snapshotFileId?: string | undefined;
}): Promise<{
baselinePath: string;
resultPath: string;
diffPath: string;
timeout?: number | undefined | undefined;
animations?: boolean | undefined | undefined;
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
failureThreshold?: number | undefined | undefined;
comparisonMethod: any;
diffOptions?: Partial<import("ssim.js").Options> | undefined;
} | {
baselinePath: string;
resultPath: string;
diffPath: string;
timeout?: number | undefined | undefined;
animations?: boolean | undefined | undefined;
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
failureThreshold?: number | undefined | undefined;
comparisonMethod?: any;
diffOptions?: {
threshold?: number | undefined;
includeAA?: boolean | undefined;
alpha?: number | undefined;
aaColor?: [number, number, number] | undefined;
diffColor?: [number, number, number] | undefined;
diffColorAlt?: [number, number, number] | undefined;
diffMask?: boolean | undefined;
} | undefined;
}>;
getTaskCount(browserContext: PartialBrowserCommandContext, taskId: string): Promise<number>;
hasImageSnapshot(browserContext: PartialBrowserCommandContext, taskId: string, snapshotFileId: string | undefined, isAutoSnapshot: boolean): Promise<boolean>;
getSnapshotFilename(browserContext: PartialBrowserCommandContext, info: {
taskId: string;
task: {
count: number;
};
}, snapshotFileId: string | undefined, isAutoSnapshot: boolean): string;
getSuiteInfo(browserContext: PartialBrowserCommandContext, taskId: string): Promise<{
projectRoot: string;
suiteId: string;
taskId: string;
baselineDir: string;
resultDir: string;
diffDir: string;
task: {
count: number;
};
}>;
};
export declare function createSuite(state: VisProjectState, testPath: string, options: Pick<VisOptions, 'customizeSnapshotSubpath'>): {
suiteId: string;
suite: {
baselineDir: string;
resultDir: string;
diffDir: string;
tasks: {};
};
};
export declare function getSuiteId(state: VisProjectState, testPath: string, options: Pick<VisOptions, 'customizeSnapshotSubpath'>): string;
//# sourceMappingURL=vis_context.logic.d.ts.map