Skip to content

Commit 56ad935

Browse files
author
Kyrsten Kelly
committed
feat: Add parameter for setting failure threshold
1 parent 61631c1 commit 56ad935

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ Disables assertions based on violations and only logs violations to the console
108108

109109
Reference : https://github.com/avanslaars/cypress-axe/issues/17
110110

111+
###### failureThreshold (optional, defaults to 0)
112+
113+
Allows you to configure the number of violations that will cause the assertion to fail. This should be used as a temporary measure while you address accessibility violations, but can help validate that you're not regressing as you progress towards 0 violations.
114+
111115
### Examples
112116

113117
#### Basic usage

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const checkA11y = (
1818
context,
1919
options,
2020
violationCallback,
21-
skipFailures = false
21+
skipFailures = false,
22+
failureThreshold = 0
2223
) => {
2324
cy.window({ log: false })
2425
.then(win => {
@@ -63,7 +64,7 @@ const checkA11y = (
6364
if (!skipFailures) {
6465
assert.equal(
6566
violations.length,
66-
0,
67+
failureThreshold,
6768
`${violations.length} accessibility violation${
6869
violations.length === 1 ? '' : 's'
6970
} ${violations.length === 1 ? 'was' : 'were'} detected`

0 commit comments

Comments
 (0)