brackt/vitest.config.ts
Chris Parsons 89a82b486f
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m40s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m38s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
Increase unit test and hook timeouts to 30s
The CI runner is slow enough that jsdom environment startup can consume
most of the default 5s budget before a test body runs. 30s is still a
real safety net against genuine infinite hangs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 22:34:39 -07:00

59 lines
1.6 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
import { fileURLToPath } from 'url';
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [react()],
resolve: {
alias: [{
find: /^~\/database\/(.*)$/,
replacement: path.resolve(__dirname, './database/$1')
}, {
find: /^~\/server\/(.*)$/,
replacement: path.resolve(__dirname, './server/$1')
}, {
find: /^~\/(.*)$/,
replacement: path.resolve(__dirname, './app/$1')
}, {
find: /^@\/(.*)$/,
replacement: path.resolve(__dirname, './app/$1')
}, {
find: 'app',
replacement: path.resolve(__dirname, './app')
}]
},
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: ['node_modules/', 'app/test/', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}', '**/types.ts']
},
projects: [{
extends: true,
test: {
name: 'unit',
globals: true,
environment: 'jsdom',
setupFiles: ['./app/test/setup.ts'],
testTimeout: 30000,
hookTimeout: 30000,
}
}, {
extends: true,
plugins: [storybookTest({ configDir: path.join(__dirname, '.storybook') })],
test: {
name: 'storybook',
browser: {
enabled: true,
headless: true,
provider: 'playwright',
instances: [{ browser: 'chromium' }]
}
}
}]
}
});