Merged in feature/storybook-tests (pull request #2623)
Feature/storybook tests * feature: add interaction tests for storybook and upgrade storybook@9 * add a11y testing for storybook * Merge branch 'master' of bitbucket.org:scandic-swap/web into feature/storybook-tests * Test and build only required packages * . * . * . * . * . * . * . * disable playwright tests in netlify ci * . * debug out process.env * don't run playwright on CI * remove unused netlify-plugin-playwright-cache * . * . * . * . * . * . * remove turbo dependancy to design-system#test * merge * merge Approved-by: Anton Gunnarsson
This commit is contained in:
52
packages/design-system/vitest.config.ts
Normal file
52
packages/design-system/vitest.config.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { defineConfig, mergeConfig } from 'vitest/config'
|
||||
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const dirname =
|
||||
typeof __dirname !== 'undefined'
|
||||
? __dirname
|
||||
: path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
import viteConfig from './vite.config'
|
||||
|
||||
const isCI = process.env.CI === 'true'
|
||||
|
||||
const browserInstances = isCI
|
||||
? [{ browser: 'chromium' }]
|
||||
: [{ browser: 'chromium' }, { browser: 'firefox' }, { browser: 'webkit' }]
|
||||
|
||||
export default mergeConfig(
|
||||
viteConfig,
|
||||
defineConfig({
|
||||
// !isCI ?
|
||||
test: {
|
||||
projects: [
|
||||
{
|
||||
plugins: [
|
||||
storybookTest({
|
||||
// The location of your Storybook config, main.js|ts
|
||||
configDir: path.join(dirname, '.storybook'),
|
||||
// This should match your package.json script to run Storybook
|
||||
// The --ci flag will skip prompts and not open a browser
|
||||
storybookScript: 'yarn storybook --ci',
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
name: 'storybook',
|
||||
// Enable browser mode
|
||||
browser: {
|
||||
enabled: true,
|
||||
// Make sure to install Playwright
|
||||
provider: 'playwright',
|
||||
headless: true,
|
||||
instances: browserInstances,
|
||||
},
|
||||
setupFiles: ['./.storybook/vitest.setup.ts'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
//: {}, // Netlify CI fails to run playwright tests. Only supported locally for now
|
||||
})
|
||||
)
|
||||
Reference in New Issue
Block a user