From d886278e5c3ff6cd04902d92cc11157de89cc8e4 Mon Sep 17 00:00:00 2001 From: Dmytro Melnyshyn Date: Thu, 7 May 2026 15:21:00 +0300 Subject: [PATCH 1/2] Add cypress.local.js extension point for local-only config overrides Adds optional, gitignored cypress.local.js that can provide: - cypress: object spread into defineConfig() for config overrides - tasks(on, config): additional Cypress task handlers - support(): beforeEach/afterEach hooks loaded from e2e.js This allows developers to add local debugging infrastructure without modifying shared files. Co-Authored-By: Claude Opus 4.6 --- .gitignore | 1 + cypress.config.js | 10 ++++++++++ cypress/support/e2e.js | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/.gitignore b/.gitignore index 929379fb9a..698d378a27 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ environments.js CLAUDE.md .claude .opencode +cypress.local.js diff --git a/cypress.config.js b/cypress.config.js index f214715a1c..a753932557 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -32,6 +32,14 @@ if (activeEnvironment && !environments[activeEnvironment]) { ); } +let cypressLocal = {}; +try { + // eslint-disable-next-line global-require + cypressLocal = require('./cypress.local'); +} catch (e) { + // cypress.local.js is gitignored and optional +} + /** * Chains after:spec handlers to ensure both TestRail and flaky marker handlers execute. * Since Cypress's on() overwrites previous handlers (except for 'task'), we need to intercept @@ -186,6 +194,7 @@ module.exports = defineConfig({ // HTTP tasks (axios requests in Node.js context) ...httpTasks, + ...cypressLocal.tasks?.(on, config), }); // keep Cypress running until the ReportPortal reporter is finished. this is a @@ -223,4 +232,5 @@ module.exports = defineConfig({ baseUrl: envOverrides.baseUrl || 'https://folio-etesting-cypress-diku.ci.folio.org', testIsolation: false, }, + ...cypressLocal.cypress, }); diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index b0e3cb5c54..287c72bbe2 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -48,3 +48,11 @@ Cypress.on('fail', (err) => { beforeEach(() => { cy.intercept('POST', '/authn/refresh').as('/authn/refresh'); }); + +// cypress.local.js support hooks (gitignored, local-only) +try { + // eslint-disable-next-line global-require + require('../../cypress.local').support?.(); +} catch (e) { + // cypress.local.js is optional +} From c612e5bf350d022db612880fdadebea9af44be75 Mon Sep 17 00:00:00 2001 From: Dmytro Melnyshyn Date: Fri, 8 May 2026 15:52:03 +0300 Subject: [PATCH 2/2] fix imports --- cypress.config.js | 4 ++-- cypress/support/e2e.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index a753932557..bbdd4d877b 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -34,8 +34,8 @@ if (activeEnvironment && !environments[activeEnvironment]) { let cypressLocal = {}; try { - // eslint-disable-next-line global-require - cypressLocal = require('./cypress.local'); + // eslint-disable-next-line global-require, import/extensions + cypressLocal = require('./cypress.local.js'); } catch (e) { // cypress.local.js is gitignored and optional } diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index 287c72bbe2..7f2edaf25c 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -51,8 +51,8 @@ beforeEach(() => { // cypress.local.js support hooks (gitignored, local-only) try { - // eslint-disable-next-line global-require - require('../../cypress.local').support?.(); + // eslint-disable-next-line global-require, import/extensions + require('../../cypress.local.js').support?.(); } catch (e) { // cypress.local.js is optional }