From 43fe7bb31376aa85b0bd02fa12aeb65c80e0719f Mon Sep 17 00:00:00 2001 From: Marco Amato Date: Thu, 4 Jan 2024 16:44:39 -0500 Subject: [PATCH 1/2] Fix required not defined --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 70654db..35289e2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,9 +28,10 @@ export interface InjectOptions { } export const injectAxe = (injectOptions?: InjectOptions) => { + const fileName = injectOptions?.axeCorePath || - (typeof require?.resolve === 'function' + (typeof require != 'undefined' && typeof require?.resolve === 'function' ? require.resolve('axe-core/axe.min.js') : 'node_modules/axe-core/axe.min.js'); cy.readFile(fileName).then((source) => From 2213c8d1a7cb9f8ffd1920dfcbe5c9d43c3a64c5 Mon Sep 17 00:00:00 2001 From: Ben Mordue Date: Wed, 15 May 2024 16:20:15 +0000 Subject: [PATCH 2/2] Update src/index.ts Co-authored-by: Corentin Hembise --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 35289e2..a5c396f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,7 @@ export const injectAxe = (injectOptions?: InjectOptions) => { const fileName = injectOptions?.axeCorePath || - (typeof require != 'undefined' && typeof require?.resolve === 'function' + (typeof require !== 'undefined' && typeof require?.resolve === 'function' ? require.resolve('axe-core/axe.min.js') : 'node_modules/axe-core/axe.min.js'); cy.readFile(fileName).then((source) =>