Skip to content

Commit

Permalink
Merge pull request #232 from radekBednarik/fix/update-pw-fix-types
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinaba-ghosh authored Aug 21, 2024
2 parents 3022773 + f1a67e0 commit 0361cf1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"jest": "^28.1.3",
"jest-each": "^28.1.3",
"jest-playwright-preset": "^2.0.0",
"playwright": "^1.41.1",
"playwright": "^1.45.0",
"prettier": "^2.7.1",
"ts-jest": "^28.0.8",
"typescript": "^4.8.4"
Expand Down
14 changes: 6 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ declare module 'axe-core' {
* @param page
*/
export const injectAxe = async (page: Page): Promise<void> => {
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)
}

Expand Down Expand Up @@ -70,7 +69,7 @@ export const getAxeResults = async (
[context, options],
)

return result
return result as Promise<AxeResults>
}

/**
Expand Down Expand Up @@ -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,
Expand All @@ -160,7 +159,6 @@ export const checkA11y = async (
reporterWithOptions = reporter
}


if (reporter !== 'html')
await reportViolations(impactedViolations, reporterWithOptions)

Expand Down

0 comments on commit 0361cf1

Please sign in to comment.