@lewiswright/vitest-plugin-vis
Version:
Vitest visual testing plugin
17 lines (13 loc) • 540 B
text/typescript
import type { BrowserCommand } from 'vitest/node'
import { visContext } from '../vis_context.ts'
import { assertTestPathDefined } from './_assertions.ts'
export interface ImageSnapshotNextIndexCommand {
/**
* Get the index of the snapshot image to be created.
*/
imageSnapshotNextIndex(taskId: string): Promise<number>
}
export const imageSnapshotNextIndex: BrowserCommand<[taskId: string]> = async (context, taskId) => {
assertTestPathDefined(context, 'imageSnapshotNextIndex')
return visContext.getTaskCount(context, taskId)
}