(
name,
callback,
{ focus = false, skip = false, shiftThreshold: newShiftThreshold } = {}
)
| 50 | * key `focus` to true to only run this test, or its `skip` key to skip it. |
| 51 | */ |
| 52 | export function visualSuite( |
| 53 | name, |
| 54 | callback, |
| 55 | { focus = false, skip = false, shiftThreshold: newShiftThreshold } = {} |
| 56 | ) { |
| 57 | let suiteFn = describe; |
| 58 | if (focus) { |
| 59 | suiteFn = suiteFn.only; |
| 60 | } |
| 61 | if (skip) { |
| 62 | suiteFn = suiteFn.skip; |
| 63 | } |
| 64 | suiteFn(name, () => { |
| 65 | let lastShiftThreshold; |
| 66 | let lastPrefix; |
| 67 | beforeAll(() => { |
| 68 | lastPrefix = namePrefix; |
| 69 | namePrefix += escapeName(name) + '/'; |
| 70 | lastShiftThreshold = shiftThreshold; |
| 71 | if (newShiftThreshold !== undefined) { |
| 72 | shiftThreshold = newShiftThreshold; |
| 73 | } |
| 74 | }); |
| 75 | |
| 76 | callback(); |
| 77 | |
| 78 | afterAll(() => { |
| 79 | namePrefix = lastPrefix; |
| 80 | shiftThreshold = lastShiftThreshold; |
| 81 | }); |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Image Diff Algorithm for p5.js Visual Tests |
no test coverage detected