When calling audit.run and passing it an include/exclude context, we do not flatten the tree anywhere, so are passing actual DOM nodes into rule.run which tries to gather the nodes using querySelectorAll but doesn't pass virtual nodes, causing them to never match the context due to matchesExpression requiring virtual nodes to match.
All the errors are being swallowed by axe so I only stumbled upon it in the tests when turning on break on caught exceptions.
"TypeError: Cannot read property 'nodeType' of undefined
at matchesTag (http://localhost:9876/tmp/core/core.js:30296:26)
at matchExpression (http://localhost:9876/tmp/core/core.js:30331:14)
at matchesExpression (http://localhost:9876/tmp/core/core.js:30517:21)
at matchExpressions (http://localhost:9876/tmp/core/core.js:32447:147)
at querySelectorAllFilter (http://localhost:9876/tmp/core/core.js:32504:14)
at select (http://localhost:9876/tmp/core/core.js:33233:109)
at Rule.gather (http://localhost:9876/tmp/core/core.js:23224:75)
at Rule.gatherAndMatchNodes (http://localhost:9876/tmp/core/core.js:23538:24)
at Rule.run (http://localhost:9876/tmp/core/core.js:23317:22)
at http://localhost:9876/tmp/core/core.js:21372:14"
(I'm not sure if it's any different if passing include/exclude from axe.run)
When calling
audit.runand passing it an include/exclude context, we do not flatten the tree anywhere, so are passing actual DOM nodes intorule.runwhich tries to gather the nodes usingquerySelectorAllbut doesn't pass virtual nodes, causing them to never match the context due tomatchesExpressionrequiring virtual nodes to match.All the errors are being swallowed by axe so I only stumbled upon it in the tests when turning on break on caught exceptions.
(I'm not sure if it's any different if passing include/exclude from axe.run)