From ef7cc4ab615c374a06b74b18a45a67757122dead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Fri, 20 Feb 2026 14:54:22 +0100 Subject: [PATCH] fix(cypress): fix invalid retries --- packages/cypress/src/support.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/cypress/src/support.ts b/packages/cypress/src/support.ts index 6cbaa0ec..885617de 100644 --- a/packages/cypress/src/support.ts +++ b/packages/cypress/src/support.ts @@ -131,6 +131,14 @@ function beforeEach(options: ArgosScreenshotOptions) { }; } +function getRetries(value: unknown) { + if (typeof value !== "number" || !Number.isFinite(value)) { + return 0; + } + const retries = Math.floor(value); + return retries < 0 ? 0 : retries; +} + /** * Wait for the UI to be ready before taking the screenshot. */ @@ -217,7 +225,7 @@ Cypress.Commands.add( titlePath: Cypress.currentTest.titlePath, retry: Cypress.currentRetry, // @ts-expect-error - private property - retries: cy.state("runnable")._retries, + retries: getRetries(cy.state("runnable")._retries), }, browser: { name: Cypress.browser.name,