TidGi-Desktop/vitest.config.ts
lin onetwo b76fc17794
Chore/upgrade (#646)
* docs: deps

* Update dependencies and type usage for AI features

Upgraded multiple dependencies in package.json and pnpm-lock.yaml, including @ai-sdk, @mui, react, and others for improved compatibility and performance. Changed type usage from CoreMessage to ModelMessage in mockOpenAI.test.ts to align with updated ai package. No functional changes to application logic.

* feat: i18n

* feat: test oauth login and use PKCE

* fix: use ollama-ai-provider-v2

* test: github and mock oauth2 login

* test: gitea login

* Refactor context menu cleanup and error message

Moved context menu cleanup for OAuth window to a single closed event handler in Authentication service. Simplified error message formatting in ContextService for missing keys.

* lint: AI fix

* Add tsx as a dev dependency and update scripts

Replaced usage of 'pnpm dlx tsx' with direct 'tsx' command in development and test scripts for improved reliability. Added 'tsx' to devDependencies in package.json.
2025-10-23 23:42:06 +08:00

71 lines
1.5 KiB
TypeScript

import path from 'path';
import swc from 'unplugin-swc';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [swc.vite({
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
})],
test: {
// Test environment
environment: 'jsdom',
// Setup files
setupFiles: ['./src/__tests__/setup-vitest.ts'],
// Test file patterns
include: [
'src/**/__tests__/**/*.(test|spec).(ts|tsx|js)',
'src/**/*.(test|spec).(ts|tsx|js)',
'features/**/*.(test|spec).(ts|tsx|js)',
],
// Global test settings - this makes vi, expect, etc. available globally
globals: true,
// Coverage settings
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
include: [
'src/**/*.{ts,tsx}',
],
exclude: [
'src/**/*.d.ts',
'src/__tests__/**/*',
'src/main.ts',
'src/preload/**/*',
],
},
pool: 'forks',
poolOptions: {
forks: {
maxForks: 6,
minForks: 2,
},
isolate: true,
},
testTimeout: 30000,
hookTimeout: 30000,
reporters: ['default', 'hanging-process'],
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@services': path.resolve(__dirname, './src/services'),
},
},
// Handle CSS and static assets
assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.gif', '**/*.svg'],
});