overleaf/server-ce/test/helpers/beforeWithReRunOnTestRetry.ts
Jakob Ackermann 9075c82b88 Merge pull request #19170 from overleaf/jpa-server-ce-re-run-before
[server-ce] make tests more robust

GitOrigin-RevId: f070b8bbbf87842a69d88ca56cecf5dd0f3a286c
2024-06-28 08:04:33 +00:00

8 lines
215 B
TypeScript

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