From bf50ce5237460adf470786d079c340809de9a5a6 Mon Sep 17 00:00:00 2001 From: omkarht Date: Wed, 26 Nov 2025 18:59:18 +0530 Subject: [PATCH] fix: handle uncaught exceptions in Gantt chart rendering test for invalid dates on-behalf-of: @Mermaid-Chart --- cypress/integration/rendering/gantt.spec.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cypress/integration/rendering/gantt.spec.js b/cypress/integration/rendering/gantt.spec.js index 72cb6ea29..db4e2bd78 100644 --- a/cypress/integration/rendering/gantt.spec.js +++ b/cypress/integration/rendering/gantt.spec.js @@ -118,6 +118,15 @@ describe('Gantt diagram', () => { ); }); it('should FAIL rendering a gantt chart for issue #1060 with invalid date', () => { + let errorCaught = false; + + cy.on('uncaught:exception', (err) => { + // Expect error related to invalid or missing date format + expect(err.message).to.include('Invalid date'); + errorCaught = true; + return false; // prevent Cypress from failing the test + }); + imgSnapshotTest( ` gantt @@ -150,12 +159,16 @@ describe('Gantt diagram', () => { section Plasma Calls & updates OVM :ovm, 2019-07-12, 120d - Plasma call 26 :pc26, 2019-08-21, 1d - Plasma call 27 :pc27, 2019-09-03, 1d - Plasma call 28 :pc28, 2019-09-17, 1d - `, + Plasma call 26 :pc26, 2019-08-21, 1d + Plasma call 27 :pc27, 2019-09-03, 1d + Plasma call 28 :pc28, 2019-09-17, 1d + `, {} ); + + cy.then(() => { + expect(errorCaught, 'Expected rendering to fail with invalid date error').to.equal(true); + }); }); it('should default to showing today marker', () => {