reactjs/react-a11y

Excluding components from tests

Closed this issue · 4 comments

Hey all, feature request time.

It would be really useful if there was a way to exclude a given component (and children) from tests.

I'm using react-a11y with redux-devtools, which gives me a whole slew of a11y errors in the devtools panel (enough to lock up my browser window because of the flood of console logs as redux-devtools re-renders).

Another common use case would be to silence false positives.

I'm having the same problem. Any current solutions?

I'm having the same issue :S under 2 minutes, the console is flooded with over 50 000 warnings, and directly make development a pain

This works fine for us:

const componentA11yBlacklist = ['LogMonitorButton', 'LogMonitorAction', 'JSONArrow', 'JSONNestedNode'];

a11y(React, {
  ReactDOM,
  filterFn: component => !componentA11yBlacklist.find(e => e === component)
});

Of course this breaks down if you actually use those components yourself

Wow, no idea how I missed filterFn. That solves the problem very nicely. Thanks @SimenB!