Skip to content

Commit 0361cf1

Browse files
Merge pull request #232 from radekBednarik/fix/update-pw-fix-types
2 parents 3022773 + f1a67e0 commit 0361cf1

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"jest": "^28.1.3",
3535
"jest-each": "^28.1.3",
3636
"jest-playwright-preset": "^2.0.0",
37-
"playwright": "^1.41.1",
37+
"playwright": "^1.45.0",
3838
"prettier": "^2.7.1",
3939
"ts-jest": "^28.0.8",
4040
"typescript": "^4.8.4"

src/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ declare module 'axe-core' {
3030
* @param page
3131
*/
3232
export const injectAxe = async (page: Page): Promise<void> => {
33-
const axe: string = fs.readFileSync(
34-
require.resolve('axe-core/axe.min.js'),
35-
'utf8',
36-
)
33+
const axe: string = fs.readFileSync(require.resolve('axe-core/axe.min.js'), {
34+
encoding: 'utf8',
35+
})
3736
await page.evaluate((axe: string) => window.eval(axe), axe)
3837
}
3938

@@ -70,7 +69,7 @@ export const getAxeResults = async (
7069
[context, options],
7170
)
7271

73-
return result
72+
return result as Promise<AxeResults>
7473
}
7574

7675
/**
@@ -143,14 +142,14 @@ export const checkA11y = async (
143142
} else console.log('There were no violations to save in report')
144143
} else if (reporter === 'junit') {
145144
// Get the system root directory
146-
// Construct the file path
145+
// Construct the file path
147146
const outputFilePath = path.join(
148147
process.cwd(),
149148
options?.outputDirPath as any,
150149
options?.outputDir as any,
151150
options?.reportFileName as any,
152151
)
153-
152+
154153
reporterWithOptions = new JUnitReporter(
155154
axeOptions?.detailedReport,
156155
page,
@@ -160,7 +159,6 @@ export const checkA11y = async (
160159
reporterWithOptions = reporter
161160
}
162161

163-
164162
if (reporter !== 'html')
165163
await reportViolations(impactedViolations, reporterWithOptions)
166164

0 commit comments

Comments
 (0)