Skip to content

Commit

Permalink
Disable axe color contrast checks
Browse files Browse the repository at this point in the history
These checks require a real browser environment and fail in jsdom.

Closes #147
  • Loading branch information
NickColley committed Nov 2, 2022
1 parent 208e197 commit 69b1f04
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,22 @@ function configureAxe (options = {}) {

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

const globalOptionOverrides = {
checks: [{
// By default, color contrast checking doesnt work in a jsdom environment.
// Disabled this check by default.
id: 'color-contrast',
enabled: false
}]
};

// Set the global configuration for
// axe-core
// https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure
axeCore.configure(globalOptions)

axeCore.configure(Object.assign({},
globalOptions,
globalOptionOverrides
))

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

0 comments on commit 69b1f04

Please sign in to comment.