test: 集成 Vitest 测试框架和开发规范

- 安装 vitest, @vue/test-utils, jsdom 等测试依赖
- 配置 vitest.config.js 测试环境
- 添加 schema.test.ts (7个数据结构验证测试)
- 添加 useStore.test.ts (7个状态管理测试)
- 创建测试指南文档 (docs/testing.md)
- 创建测试规范文档 (docs/testing-rules.md)
- 创建开发规范文档 (docs/development-rules.md)
- 创建开发工作流程文档 (docs/1management/workflow.md)
- 添加测试相关 npm scripts (test, test:watch, test:ui, test:coverage)
- 所有测试通过 (14/14)
This commit is contained in:
2026-02-12 23:25:13 +08:00
parent c4d701b443
commit 92aa4094f5
13 changed files with 4245 additions and 17 deletions

View File

@@ -7,8 +7,13 @@
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test": "vitest --run",
"test:watch": "vitest",
"test:ui": "vitest --ui",
"test:coverage": "vitest --coverage",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
"format": "prettier --write src/"
"format": "prettier --write src/",
"precommit": "npm test && npm run lint"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
@@ -29,10 +34,17 @@
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.3",
"@vitejs/plugin-vue": "^4.5.1",
"@vitest/ui": "^4.0.18",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/test-utils": "^2.4.6",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"happy-dom": "^20.6.1",
"husky": "^9.1.7",
"jsdom": "^28.0.0",
"lint-staged": "^16.2.7",
"prettier": "^3.0.3",
"vite": "^5.0.5"
"vite": "^5.0.5",
"vitest": "^4.0.18"
}
}