From 43fe7bb31376aa85b0bd02fa12aeb65c80e0719f Mon Sep 17 00:00:00 2001 From: Marco Amato Date: Thu, 4 Jan 2024 16:44:39 -0500 Subject: [PATCH] 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) =>