storybook-addon-vis-v9-fix-test
Version:
Storybook Vitest visual testing addon
14 lines (11 loc) • 445 B
text/typescript
import { hasImageSnapshotAction, toTaskId, type ImageSnapshotKeyOptions } from 'vitest-plugin-vis/client-api'
import { ctx } from './ctx.ts'
import { commands } from './vitest_proxy.ts'
/**
* Check if the snapshot image exists.
*/
export function hasImageSnapshot(options?: ImageSnapshotKeyOptions | undefined) {
const test = ctx.getCurrentTest()
if (!test) return false
return hasImageSnapshotAction(commands, toTaskId(test), options)
}