@@ -30,10 +30,9 @@ declare module 'axe-core' {
3030 * @param page
3131 */
3232export 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