vitest-plugin-vis
Version:
Vitest visual testing plugin
15 lines (12 loc) • 524 B
text/typescript
import type { HasImageSnapshotCommand, ImageSnapshotNextIndexCommand } from '../../shared/commands.types.ts'
import type { ImageSnapshotKeyOptions } from '../../shared/types.ts'
export function hasImageSnapshotAction(
commands: ImageSnapshotNextIndexCommand & HasImageSnapshotCommand,
taskId: string,
options?: ImageSnapshotKeyOptions | undefined,
) {
if (options?.snapshotKey?.includes('-')) {
throw new Error('Snapshot key cannot contain dash')
}
return commands.hasImageSnapshot(taskId, options?.snapshotKey)
}