From 80a2dc7a3ed83a93cf7ec45e29573578d772364b Mon Sep 17 00:00:00 2001 From: "radek.Bednarik" Date: Tue, 25 Jun 2024 08:34:11 +0200 Subject: [PATCH] chore: fix type errors and update pw dep to 1.45.0 --- src/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8f66453..01e936e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,10 +30,9 @@ declare module 'axe-core' { * @param page */ export const injectAxe = async (page: Page): Promise => { - const axe: string = fs.readFileSync( - require.resolve('axe-core/axe.min.js'), - 'utf8', - ) + const axe: string = fs.readFileSync(require.resolve('axe-core/axe.min.js'), { + encoding: 'utf8', + }) await page.evaluate((axe: string) => window.eval(axe), axe) } @@ -70,7 +69,7 @@ export const getAxeResults = async ( [context, options], ) - return result + return result as Promise } /** @@ -143,14 +142,14 @@ export const checkA11y = async ( } else console.log('There were no violations to save in report') } else if (reporter === 'junit') { // Get the system root directory - // Construct the file path + // Construct the file path const outputFilePath = path.join( process.cwd(), options?.outputDirPath as any, options?.outputDir as any, options?.reportFileName as any, ) - + reporterWithOptions = new JUnitReporter( axeOptions?.detailedReport, page, @@ -160,7 +159,6 @@ export const checkA11y = async ( reporterWithOptions = reporter } - if (reporter !== 'html') await reportViolations(impactedViolations, reporterWithOptions)