mirror of
https://github.com/joinmarket-webui/jam.git
synced 2026-08-13 12:33:26 +02:00
* build(deps): update dependencies @vitejs/plugin-react 6.0.4 → 6.0.5 lucide-react 1.26.0 → 1.28.0 react-router-dom 7.18.1 → 7.18.2 vite 8.1.5 → 8.2.0 @storybook/addon-a11y 10.5.4 → 10.5.5 @storybook/addon-docs 10.5.4 → 10.5.5 @storybook/addon-vitest 10.5.4 → 10.5.5 @storybook/react-vite 10.5.4 → 10.5.5 @types/node 26.1.1 → 26.1.2 eslint-plugin-storybook 10.5.4 → 10.5.5 storybook 10.5.4 → 10.5.5 @playwright/test 1.61.1 → 1.62.0 @testing-library/jest-dom 6.9.1 → 6.10.0 globals 17.7.0 → 17.8.0 * build: fix vitest warnings after update * build(deps): update @hookform/resolvers to v5.5.7 * build(deps): update msw-storybook-addon to v3.0.0 note: still uses a deprecated feature as the migration path did not work properly * build(dev-deps): update jsdom to v30.0.1
79 lines
2.8 KiB
TypeScript
79 lines
2.8 KiB
TypeScript
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'
|
|
import { playwright } from '@vitest/browser-playwright'
|
|
import path from 'node:path'
|
|
import { mergeConfig } from 'vite'
|
|
import { ConfigEnv, coverageConfigDefaults, defineConfig, type ViteUserConfig } from 'vitest/config'
|
|
import viteConfig from './vite.config.ts'
|
|
|
|
export default defineConfig((args: ConfigEnv): ViteUserConfig => {
|
|
return mergeConfig(viteConfig(args), {
|
|
test: {
|
|
env: {
|
|
LC_ALL: 'en_US.UTF-8',
|
|
},
|
|
coverage: {
|
|
// 'json-summary' is required for ci coverage report
|
|
reporter: ['text', 'json', 'json-summary'],
|
|
// enable coverage reports even if tests are failing
|
|
reportOnFailure: true,
|
|
include: ['src/**/*.{ts,tsx}'],
|
|
exclude: [
|
|
...coverageConfigDefaults.exclude,
|
|
// type declarations carry no runtime code
|
|
'**/*.d.ts',
|
|
// pure re-export barrel
|
|
'src/components/earn/CreateFidelityBondDialog/index.ts',
|
|
// test-only helpers and config
|
|
'src/test/**',
|
|
'src/i18n/testConfig.ts',
|
|
'src/main.tsx',
|
|
],
|
|
thresholds: {
|
|
lines: 85,
|
|
functions: 85,
|
|
branches: 80,
|
|
statements: 85,
|
|
},
|
|
},
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
plugins: [
|
|
// The plugin will run tests for the stories defined in your Storybook config
|
|
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
storybookTest({ configDir: path.resolve(import.meta.dirname, './.storybook') }),
|
|
],
|
|
test: {
|
|
name: 'storybook',
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: playwright({}),
|
|
instances: [{ browser: 'chromium' }],
|
|
},
|
|
setupFiles: ['.storybook/vitest.setup.ts'],
|
|
// Set `isolate` to `false` to prevent frequent storybook errors.
|
|
// ("Failed to fetch dynamically imported module" and "Cannot connect to the iframe")
|
|
// See: https://storybook.js.org/docs/writing-tests/integrations/vitest-addon/index#why-do-my-tests-fail-in-ci-with-failed-to-fetch-dynamically-imported-module-or-cannot-connect-to-the-iframe
|
|
isolate: false,
|
|
},
|
|
},
|
|
{
|
|
test: {
|
|
name: 'unit',
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: './vitest.setup.ts',
|
|
include: ['**/*.test.{ts,tsx}'],
|
|
exclude: ['src/lib/hash.slow.test.ts', 'node_modules', '.storybook'],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(import.meta.dirname, './src'),
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})
|
|
})
|