diff --git a/.storybook/main.js b/.storybook/main.ts similarity index 88% rename from .storybook/main.js rename to .storybook/main.ts index 6e9b79227..38137feed 100644 --- a/.storybook/main.js +++ b/.storybook/main.ts @@ -1,4 +1,6 @@ -module.exports = { +import type { StorybookConfig } from '@storybook/core-common'; + +const config: StorybookConfig = { stories: [ '../tests/**/*.stories.tsx' ], @@ -34,4 +36,6 @@ module.exports = { config.resolve.alias['../utils/location-operations'] = require.resolve('../tests/__fixtures__/utils/location-operations.ts'); return config; } -}; \ No newline at end of file +}; + +export default config; \ No newline at end of file diff --git a/.storybook/preview.js b/.storybook/preview.ts similarity index 91% rename from .storybook/preview.js rename to .storybook/preview.ts index a78ee0372..aae99fb38 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.ts @@ -1,7 +1,8 @@ import './index.css'; import { SearchCoreDecorator } from '../tests/__fixtures__/core/SearchCore'; +import { Parameters } from '@storybook/csf'; -export const parameters = { +export const parameters: Parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, controls: { matchers: { diff --git a/.storybook/test-runner.ts b/.storybook/test-runner.ts index 8e2f8bf75..fe35b6295 100644 --- a/.storybook/test-runner.ts +++ b/.storybook/test-runner.ts @@ -1,5 +1,6 @@ import { injectAxe, checkA11y } from 'axe-playwright'; import { Page } from 'playwright-core'; +import { parameters } from './preview'; /* * See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental @@ -12,10 +13,7 @@ const renderFunctions = { async postRender(page: Page, context) { await checkA11y(page, '#root', { axeOptions: { - runOnly: { - type: 'tag', - values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'] - }, + runOnly: parameters.a11y.options.runOnly, rules: { 'color-contrast': { enabled: context.name !== 'Loading' } },