Skip to content

Commit

Permalink
Always reset axe config
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuth committed Feb 12, 2024
1 parent 5e49b13 commit 418ee67
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/browser/AxePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ function runAxe({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This function executes in a browser context.
return window.axeQueue.add(() => {
// Always reset the axe config, so if one story sets its own config it doesn't affect the
// others.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This function executes in a browser context.
window.axe.reset();

if (config) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This function executes in a browser context.
window.axe.configure(config);
} else {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This function executes in a browser context.
window.axe.reset();
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This function executes in a browser context.
return window.axe.run(document, options);
Expand Down

0 comments on commit 418ee67

Please sign in to comment.