defineAutoSnapshotParam
defineAutoSnapshotParam() returns { snapshot }, typed so your editor completes the options.
Use it as the parameters of a story, a story file or the preview.
import { defineAutoSnapshotParam } from 'storybook-addon-vis'
export const Primary = { tags: ['snapshot'], parameters: defineAutoSnapshotParam({ failureThreshold: 0.3, failureThresholdType: 'percent', subject: '[data-testid="alt"]', }),}Signature
Section titled “Signature”function defineAutoSnapshotParam<M extends ComparisonMethod>( snapshot: ToMatchImageSnapshotOptions<M> & ImageSnapshotSubjectOptions,): { snapshot: typeof snapshot }Options
Section titled “Options”The options are the matcher options (comparisonMethod, diffOptions, threshold, timeout, snapshotKey) plus subject.
They belong to vitest-plugin-vis, see toMatchImageSnapshot.
It applies to automatic snapshots only.
A snapshot taken in play ignores it: pass the options to the matcher.
See Thresholds and comparison for stories.