brackt/vitest.config.ts
chrisp ffb1642ab6
All checks were successful
🚀 Deploy / 🧪 Test (push) Successful in 2m46s
🚀 Deploy / ʦ🔍 Typecheck & Lint (push) Successful in 1m26s
🚀 Deploy / 🐳 Build (push) Successful in 1m29s
🚀 Deploy / 🚀 Deploy (push) Successful in 10s
Remove flaky context menu click tests (#81)
## Summary

- Deletes 12 `it("calls onX with correct args")` test blocks from `MiniDraftGrid.test.tsx` and `DraftGridSection.test.tsx`
- Removes now-unused `import userEvent` from both files

## Why

`userEvent.setup().click()` hangs indefinitely on Radix UI `ContextMenu` items in jsdom — pointer-event and animation checks stall waiting for CSS transitions that never fire `transitionend` in the test environment. This caused a flaky 5 s timeout in CI.

The deleted tests were verifying that clicking a `ContextMenuItem` fires its `onClick` — React/Radix wiring, not app logic. The remaining presence/absence tests already cover the conditional rendering (which items appear under which conditions), which is where the actual app logic lives.

## Test plan

- [ ] `npm run test:run -- MiniDraftGrid DraftGridSection` — all remaining tests pass, no timeouts

Co-authored-by: Chris Parsons <chrisparsons1127@gmail.com>
Reviewed-on: #81
2026-06-10 05:59:49 +00: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' }]
}
}
}]
}
});