Skip to content

Commit

Permalink
update esnlint deps and fix docs test runner type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mcwinter07 committed Jan 14, 2025
1 parent 10e4850 commit de1116b
Show file tree
Hide file tree
Showing 3 changed files with 838 additions and 151 deletions.
7 changes: 4 additions & 3 deletions docs/test-runner.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { getStoryContext, type TestRunnerConfig } from '@storybook/test-runner'
import { configureAxe, getAxeResults, injectAxe } from 'axe-playwright'
import { toHaveNoViolations } from 'jest-axe'
import { type Page } from 'playwright'
import { globalA11yRules } from './utils/global-a11y-rules'

const config = {
setup: () => {
expect.extend(toHaveNoViolations)
},
preVisit: async (page) => {
await injectAxe(page)
await injectAxe(page as Page)
},
postVisit: async (page, context) => {
const { parameters } = await getStoryContext(page, context)
Expand All @@ -21,14 +22,14 @@ const config = {
const storyRules = parameters?.a11y?.config?.rules || []
const rules = [...globalA11yRules, ...storyRules]

await configureAxe(page, { ...parameters.a11y?.config, rules })
await configureAxe(page as Page, { ...parameters.a11y?.config, rules })

if (parameters?.a11y?.timeout) {
await page.waitForTimeout(parameters.a11y.timeout)
}

const a11yResults = await getAxeResults(
page,
page as Page,
parameters?.a11y?.element ?? '#storybook-root',
parameters?.a11y?.options,
)
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@
"@types/react-dom": "^18.3.1",
"@vitest/eslint-plugin": "^1.1.24",
"chromatic": "^11.20.0",
"eslint": "^9.16.0",
"eslint": "^9.18.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-storybook": "^0.11.1",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-storybook": "^0.11.2",
"globals": "^15.13.0",
"node-fetch": "^3.3.2",
"playwright": "^1.49.1",
Expand Down
Loading

0 comments on commit de1116b

Please sign in to comment.