Skip to content

Commit 48824b2

Browse files
author
Nick Colley
committed
Disable axe color contrast checks
These checks require a real browser environment and fail in jsdom. Closes #147
1 parent 208e197 commit 48824b2

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

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)