fix: 修复前端登录体验和API调用问题
- 修复路由守卫:未登录时直接跳转,不显示提示信息 - 修复API拦截器:401错误直接跳转,无需确认 - 移除不必要的ElMessageBox确认框 - 优化Token过期处理逻辑 - 修复文件管理API引入路径和URL前缀 - 修复调拨/回收管理API端点不匹配问题 - 修复通知管理API方法不匹配问题 - 统一系统配置API路径为单数形式 影响文件: - src/router/index.ts - src/api/request.ts - src/api/file.ts - src/api/index.ts 测试状态: - 前端构建通过 - 所有API路径已验证 - 登录流程测试通过 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
105
vitest.config.ts
Normal file
105
vitest.config.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/// <reference types="vitest" />
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src')
|
||||
}
|
||||
},
|
||||
test: {
|
||||
// 测试环境
|
||||
environment: 'jsdom',
|
||||
|
||||
// 全局配置
|
||||
globals: true,
|
||||
|
||||
// 设置超时时间
|
||||
testTimeout: 10000,
|
||||
hookTimeout: 10000,
|
||||
|
||||
// 覆盖率配置
|
||||
coverage: {
|
||||
// 提供器
|
||||
provider: 'v8',
|
||||
|
||||
// 覆盖率报告目录
|
||||
reportsDirectory: './test_reports/coverage',
|
||||
|
||||
// 覆盖率报告格式
|
||||
reporter: [
|
||||
'text',
|
||||
'json',
|
||||
'html',
|
||||
'lcov',
|
||||
'lcovonly'
|
||||
],
|
||||
|
||||
// 覆盖率阈值
|
||||
lines: 70,
|
||||
functions: 70,
|
||||
branches: 70,
|
||||
statements: 70,
|
||||
|
||||
// 包含的文件
|
||||
include: [
|
||||
'src/**/*.{js,ts,vue}',
|
||||
'!src/main.ts',
|
||||
'!src/**/*.d.ts'
|
||||
],
|
||||
|
||||
// 排除的文件
|
||||
exclude: [
|
||||
'node_modules/',
|
||||
'tests/',
|
||||
'**/*.spec.ts',
|
||||
'**/*.test.ts',
|
||||
'**/types/',
|
||||
'**/router/',
|
||||
'**/main.ts'
|
||||
]
|
||||
},
|
||||
|
||||
// 测试文件匹配模式
|
||||
include: [
|
||||
'tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
||||
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
|
||||
],
|
||||
|
||||
// 排除的文件
|
||||
exclude: [
|
||||
'node_modules',
|
||||
'dist',
|
||||
'.idea',
|
||||
'.git',
|
||||
'.cache'
|
||||
],
|
||||
|
||||
// 全局setup文件
|
||||
setupFiles: ['./tests/setup.ts'],
|
||||
|
||||
// 监听模式配置
|
||||
watch: false,
|
||||
|
||||
// 并行执行
|
||||
threads: true,
|
||||
maxThreads: 4,
|
||||
minThreads: 1,
|
||||
|
||||
// 隔穿环境
|
||||
isolate: true,
|
||||
|
||||
// 报告器
|
||||
reporters: ['verbose', 'json', 'html'],
|
||||
|
||||
// 输出目录
|
||||
outputFile: {
|
||||
json: './test_reports/vitest-results.json',
|
||||
html: './test_reports/vitest-report.html'
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user