0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/.storybook/main.js
Paul D'Ambra 36622515f1
fix: home accessibility (#11211)
* feat: test a11y with Cypress

* axe test more pages

* archive a11y violations on success too

* remove date from file path

* don't warn if no accessibility files to upload... they're not on all test jobs

* support switching accessibility tests to failing

* support aria label on lemon buttons

* add story book axe add-on

* Defuckulate the tests

* oops

* can't stop skipping a11y failures for home just yet
2022-08-09 20:01:58 +01:00

67 lines
2.1 KiB
JavaScript

const { createEntry } = require('../webpack.config')
const babelConfig = require('../babel.config')
module.exports = {
stories: ['../frontend/src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
{
name: '@storybook/addon-docs',
options: {
sourceLoaderOptions: {
injectStoryParameters: false,
},
},
},
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-storysource',
{
name: 'storybook-addon-turbo-build',
options: {
optimizationLevel: 3,
},
},
'@storybook/addon-a11y',
],
staticDirs: ['public'],
babel: async () => {
// compile babel to "defaults" target (ES5)
const envPreset = babelConfig.presets.find(
(preset) => Array.isArray(preset) && preset[0] === '@babel/preset-env'
)
envPreset[1].targets = 'defaults'
return babelConfig
},
webpackFinal: (config) => {
const mainConfig = createEntry('main')
return {
...config,
resolve: {
...config.resolve,
extensions: [...config.resolve.extensions, ...mainConfig.resolve.extensions],
alias: { ...config.resolve.alias, ...mainConfig.resolve.alias },
},
module: {
...config.module,
rules: [
...mainConfig.module.rules,
...config.module.rules.filter((rule) => rule.test.toString().includes('.mdx')),
{
test: /\.stories\.tsx?$/,
use: [
{
loader: require.resolve('@storybook/source-loader'),
options: { parser: 'typescript' },
},
],
enforce: 'pre',
},
],
},
}
},
features: {
postcss: false,
},
}