@@ -142,9 +142,11 @@ function logFailureMessage(
142142) : void {
143143 // this exists on axe but we don't export it as part of the typescript
144144 // namespace, so just let me use it as I need
145- const message : string = ( ( axeCore as unknown ) as AxeWithAudit ) . _audit . data . failureSummaries [
146- key
147- ] . failureMessage ( node [ key ] . map ( check => check . message || '' ) ) ;
145+ const message : string = (
146+ axeCore as unknown as AxeWithAudit
147+ ) . _audit . data . failureSummaries [ key ] . failureMessage (
148+ node [ key ] . map ( check => check . message || '' )
149+ ) ;
148150
149151 console . error ( message ) ;
150152}
@@ -208,30 +210,31 @@ function checkAndReport(node: Node, timeout: number): Promise<void> {
208210 }
209211 }
210212 axeCore . configure ( { allowedOrigins : [ '<unsafe_all_origins>' ] } ) ;
211- axeCore . run ( n , { reporter : 'v2' } , function (
212- error : Error ,
213- results : axeCore . AxeResults
214- ) {
215- if ( error ) {
216- return reject ( error ) ;
217- }
218-
219- results . violations = results . violations . filter ( result => {
220- result . nodes = result . nodes . filter ( node => {
221- const key : string = node . target . toString ( ) + result . id ;
222- const retVal = ! cache [ key ] ;
223- cache [ key ] = key ;
224- return disableDeduplicate || retVal ;
213+ axeCore . run (
214+ n ,
215+ { reporter : 'v2' } ,
216+ function ( error : Error , results : axeCore . AxeResults ) {
217+ if ( error ) {
218+ return reject ( error ) ;
219+ }
220+
221+ results . violations = results . violations . filter ( result => {
222+ result . nodes = result . nodes . filter ( node => {
223+ const key : string = node . target . toString ( ) + result . id ;
224+ const retVal = ! cache [ key ] ;
225+ cache [ key ] = key ;
226+ return disableDeduplicate || retVal ;
227+ } ) ;
228+ return ! ! result . nodes . length ;
225229 } ) ;
226- return ! ! result . nodes . length ;
227- } ) ;
228230
229- if ( results . violations . length ) {
230- logger ( results ) ;
231- }
231+ if ( results . violations . length ) {
232+ logger ( results ) ;
233+ }
232234
233- resolve ( ) ;
234- } ) ;
235+ resolve ( ) ;
236+ }
237+ ) ;
235238 } ,
236239 {
237240 timeout : timeout
@@ -286,6 +289,8 @@ function addComponent(component: any): void {
286289 const reactInstanceDebugID = reactInstance . _debugID ;
287290 const reactFiberInstance = component . _reactInternalFiber || { } ;
288291 const reactFiberInstanceDebugID = reactFiberInstance . _debugID ;
292+ const reactInternals = component . _reactInternals || { } ;
293+ const reactInternalsDebugID = reactInternals . _debugID ;
289294
290295 if ( reactInstanceDebugID && ! components [ reactInstanceDebugID ] ) {
291296 components [ reactInstanceDebugID ] = component ;
@@ -296,6 +301,9 @@ function addComponent(component: any): void {
296301 ) {
297302 components [ reactFiberInstanceDebugID ] = component ;
298303 componentAfterRender ( component ) ;
304+ } else if ( reactInternalsDebugID && ! components [ reactInternalsDebugID ] ) {
305+ components [ reactInternalsDebugID ] = component ;
306+ componentAfterRender ( component ) ;
299307 }
300308}
301309
0 commit comments