Skip to content

Commit 19348b8

Browse files
author
mcha
committed
fix(src/index types): expose conlsoleReport, name violationsCb
1 parent e673390 commit 19348b8

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = (on, config) => {
5454
}
5555
```
5656

57-
> **NOTE**: You can control how results are displayed via [the `violationsCallback` config option](#cyconfigureCypressAxe)
57+
> **NOTE**: You can control how results are displayed via [the `violationsCb` config option](#cyconfigureCypressAxe)
5858
5959
After following the steps above (_and defining cy.tasks_), violations will be displayed as follows:
6060

@@ -91,10 +91,10 @@ it('passes axe', () => {
9191
// ...
9292

9393
cy.checkA11y() // checks the whole document
94-
94+
9595
cy.get('#mobile-menu').checkA11y() // checks id="mobile-menu only
96-
97-
cy.wrap({ exclude: ['.not-me']}).checkA11y() // checks the whole document except class=".not-me"
96+
97+
cy.wrap({ exclude: ['.not-me'] }).checkA11y() // checks the whole document except class=".not-me"
9898
})
9999
```
100100

@@ -165,16 +165,16 @@ Instead of wrapping or overwriting `cy.checkA11y`, you can configure it. It acce
165165
- `axeOptions` passed to axe-core.
166166
- `shouldFailFn` function that returns array of violations to check for.
167167
- `skipFailures` if true, it will log the violations but not assert against them.
168-
- `violationsCallback` reporter function that receives the result.
168+
- `violationsCb` reporter function that receives the result.
169169

170-
**The default** `violationsCallback` function assumes that `cy.task('log')` and `cy.task('table')` have been defined already during the [Installation & setup](#Installation-and-Setup). If you don't want to define those tasks, you can pass a function here to control how results are outputted.
170+
**The default** `violationsCb` function assumes that `cy.task('log')` and `cy.task('table')` have been defined already during the [Installation & setup](#Installation-and-Setup). If you don't want to define those tasks, you can pass a function here to control how results are outputted.
171171

172172
```js
173173
cy.configureCypressAxe({
174174
axeOptions: [], // axe.RunOptions[]
175175
shouldFailFn: violations => violations,
176176
skipFailures: false,
177-
violationsCallback: ({
177+
violationsCb: ({
178178
filename: 'test.spec.ts', // spec filename
179179
results: [], // violations axe.Result[]
180180
label: 'my custom component', // if passed to checkA11y

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from './utils';
77
import type { CypressAxeOptions, RunResults } from './types';
88

9-
export { CypressAxeOptions, RunResults };
9+
export { CypressAxeOptions, RunResults, consoleReporter };
1010

1111
let defaultCypressAxeConfig = {
1212
axeOptions: {},

src/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export interface CypressAxeOptions {
2323
axeOptions?: axe.RunOptions;
2424
shouldFailFn?(violations: axe.Result[]): axe.Result[];
2525
skipFailures?: boolean;
26-
violationsCallback?(results: RunResults): void;
26+
violationsCb?(results: RunResults): void;
2727
}
2828

2929
export interface RunResults {
30-
filename: string,
31-
results: axe.Result[]
32-
label?: string,
30+
filename: string;
31+
results: axe.Result[];
32+
label?: string;
3333
}

0 commit comments

Comments
 (0)