@lewiswright/vitest-plugin-vis
Version:
Vitest visual testing plugin
20 lines (17 loc) • 406 B
text/typescript
type Task = {
name: string
suite?: Task | undefined
}
/**
* @deprecated not needed anymore. Use `matchImageSnapshot` directly instead.
*/
export function toTaskId(task: Task) {
const l: any[] = []
let t = task
while (t?.suite) {
l.unshift(t.suite.name.replace(/[^a-z0-9]/gi, '-').toLowerCase())
t = t.suite
}
l.push(task.name.replace(/[^a-z0-9]/gi, '-').toLowerCase())
return l.join('/')
}