mirror of
https://github.com/VirtualHotBar/NetMount.git
synced 2026-05-06 21:31:59 +08:00
Introduce comprehensive architectural improvements including service layer, state management stores, repository pattern, unified logging and error handling, and test infrastructure. Key changes: - Add service layer with ConfigService, LoggerService, ErrorService, and storage services (StorageManager, FileManager, TransferService) - Implement Zustand stores for rclone, openlist, mount, storage, settings, stats, and task state management - Introduce repository layer with BaseRepository and specific implementations (ConfigRepository, StorageRepository) - Add unified logging system with structured output, levels, and persistence - Implement centralized error handling with categorization, user-friendly messages, and recovery - Create component library with ErrorBoundary and reusable UI components - Add comprehensive test suite with Vitest, setup, and utilities - Migrate from monolithic files to modular structure with proper separation of concerns - Update build configuration, add vitest.config.ts, and enhance TypeScript paths - Remove deprecated files (tauriUpdater.ts, test.ts, storageRepository.ts, etc.) BREAKING CHANGE: Major API and structural changes require updates to component imports and state access patterns. Migration guide available in docs/LOGGING_MIGRATION_GUIDE.md.
68 lines
1.6 KiB
TypeScript
68 lines
1.6 KiB
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'path'
|
|
|
|
// https://vitest.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
// 使用 jsdom 环境进行组件测试
|
|
environment: 'jsdom',
|
|
|
|
// 全局测试超时时间
|
|
testTimeout: 10000,
|
|
|
|
// 包含测试文件的模式
|
|
include: ['src/**/*.{test,spec}.{ts,tsx}'],
|
|
|
|
// 排除的文件
|
|
exclude: ['**/node_modules/**', '**/dist/**', '**/e2e/**'],
|
|
|
|
// 全局测试设置
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
|
|
// CSS 模块支持
|
|
css: true,
|
|
|
|
// 覆盖率配置
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
include: ['src/**/*.{ts,tsx}'],
|
|
exclude: [
|
|
'src/**/*.d.ts',
|
|
'src/test/**',
|
|
'src/**/*.{test,spec}.{ts,tsx}',
|
|
'src/main.tsx',
|
|
'src/app.tsx',
|
|
],
|
|
thresholds: {
|
|
lines: 0,
|
|
functions: 0,
|
|
branches: 0,
|
|
statements: 0,
|
|
},
|
|
},
|
|
|
|
// CI 友好输出
|
|
reporters: ['default'],
|
|
|
|
// 模拟配置
|
|
mockReset: true,
|
|
clearMocks: true,
|
|
|
|
// 全局测试 API
|
|
globals: true,
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
'@services': path.resolve(__dirname, './src/services'),
|
|
'@utils': path.resolve(__dirname, './src/utils'),
|
|
'@type': path.resolve(__dirname, './src/type'),
|
|
'@controller': path.resolve(__dirname, './src/controller'),
|
|
'@page': path.resolve(__dirname, './src/page'),
|
|
},
|
|
},
|
|
})
|