overleaf/server-ce/test/helpers/beforeWithReRunOnTestRetry.ts

9 lines
215 B
TypeScript
Raw Permalink Normal View History

export function beforeWithReRunOnTestRetry(fn: () => void | Promise<any>) {
let ranOnce = false
beforeEach(() => {
if (ranOnce && Cypress.currentRetry === 0) return
ranOnce = true
return fn()
})
}