Skip to content

Commit d55cd80

Browse files
authored
Merge pull request #252 from NickColley/disabled-broken-rule
Disable axe color contrast checks
2 parents 208e197 + 81a8e52 commit d55cd80

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ module.exports = axe
289289

290290
Refer to [Developing Axe-core Rules](https://github.com/dequelabs/axe-core/blob/master/doc/rule-development.md) for instructions on how to develop custom rules and checks.
291291

292+
## Checks that do not work in jest-axe
293+
294+
Color contrast checks do not work in JSDOM so are turned off in jest-axe.
295+
292296
## Thanks
293297
- [Jest][Jest] for the great test runner that allows extending matchers.
294298
- [axe](https://www.deque.com/axe/) for the wonderful axe-core that makes it so easy to do this.

index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,20 @@ function configureAxe (options = {}) {
4747

4848
const { globalOptions = {}, ...runnerOptions } = options
4949

50-
// Set the global configuration for
51-
// axe-core
50+
// Set the global configuration for axe-core
5251
// https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure
53-
axeCore.configure(globalOptions)
54-
52+
const { checks = [], ...otherGlobalOptions } = globalOptions
53+
axeCore.configure({
54+
checks: [
55+
{
56+
// color contrast checking doesnt work in a jsdom environment.
57+
id: 'color-contrast',
58+
enabled: false
59+
},
60+
...checks
61+
],
62+
...otherGlobalOptions
63+
})
5564

5665
/**
5766
* Small wrapper for axe-core#run that enables promises (required for Jest),

0 commit comments

Comments
 (0)