chore: add comprehensive documentation and testing infrastructure

## 文档(全部中文)
- AGENTS.md - 完整的 AI 编码指南(中文版)
- CONTRIBUTING.md - 贡献指南
- DEVELOPMENT.md - 开发文档
- DEPLOYMENT.md - 部署文档
- TESTING.md - 测试文档
- TROUBLESHOOTING.md - 问题排查指南
- FAQ.md - 常见问题
- WORKFLOW.md - 标准开发流程文档
## AI 工作流(9个详细工作流)
- feature-development.md - 新功能开发流程
- bug-fix.md - Bug 修复流程
- code-review.md - 代码审查流程
- testing.md - 测试编写流程
- release.md - 发布流程
- refactoring.md - 代码重构流程
- documentation.md - 文档更新流程
- performance-optimization.md - 性能优化流程
- security-audit.md - 安全审计流程
## 测试基础设施
- vitest.config.ts - Vitest 单元测试配置
- playwright.config.ts - Playwright E2E 测试配置
- src/__tests__/setup.ts - 测试环境设置
- src/__tests__/unit/downloadStatus.test.ts - 示例单元测试
- e2e/basic.spec.ts - 示例 E2E 测试
## CI/CD
- .github/workflows/test.yml - 新建测试 CI 工作流
- .github/workflows/build.yml - 更新构建工作流,添加测试步骤
## Issue 模板
- 更新 bug_report.md 为标准 Bug 报告模板
- 更新 help_wanted.md 为标准功能请求模板
## 配置更新
- package.json - 添加测试依赖和 7 个新的 npm 脚本
- .gitignore - 添加测试相关忽略项
## 新增 npm 脚本
- test - 运行单元测试
- test:watch - 监听模式
- test:coverage - 生成覆盖率报告
- test:e2e - 运行 E2E 测试
- test:e2e:ui - E2E UI 模式
- test:e2e:debug - E2E 调试模式
- test:all - 运行所有测试
## 新增测试依赖
- @playwright/test ^1.40.0
- @testing-library/jest-dom ^6.1.5
- @testing-library/vue ^8.0.1
- @vitest/coverage-v8 ^1.0.0
- @vue/test-utils ^2.4.3
- jsdom ^23.0.1
- vitest ^1.0.0
This commit is contained in:
2026-03-10 00:42:56 +08:00
parent 0035b3000d
commit cef68a95d9
31 changed files with 5403 additions and 424 deletions

View File

@@ -1,11 +1,52 @@
---
name: 🐞 Bug report
about: Create a report to help us improve
title: "[Bug] the title of bug report"
name: Bug 报告
about: 创建一个 Bug 报告以帮助我们改进
title: "[Bug] "
labels: bug
assignees: ''
assignees: ""
---
#### Describe the bug
## 描述
清晰简洁地描述这个 Bug 是什么。
## 复现步骤
1. 打开 '...'
2. 点击 '....'
3. 滚动到 '....'
4. 看到错误
## 期望行为
清晰简洁地描述你期望发生什么。
## 实际行为
清晰简洁地描述实际发生了什么。
## 截图
如果适用,添加截图以帮助解释你的问题。
## 环境信息
**操作系统:** [例如: Ubuntu 22.04]
**APM 版本:** [例如: 1.0.0]
**应用商店版本:** [例如: 4.9.9]
**桌面环境:** [例如: GNOME, KDE]
## 日志
如果相关,粘贴日志到以下区域(使用代码块):
```
粘贴日志内容
```
## 额外上下文
添加任何其他关于问题的上下文信息。

View File

@@ -1,10 +1,23 @@
---
name: 🥺 Help wanted
about: Confuse about the use of electron-vue-vite
title: "[Help] the title of help wanted report"
labels: help wanted
assignees: ''
name: 功能请求 / 帮助请求
about: 为这个项目建议一个新想法
title: "[Feature] "
labels: enhancement
assignees: ""
---
#### Describe the problem you confuse
## 你的功能请求是否与问题有关?
清晰简洁地描述问题。例如:我在 [...] 时总是感到沮丧
## 你想要的解决方案是什么?
清晰简洁地描述你想要发生什么。
## 你考虑过哪些替代方案?
清晰简洁地描述你考虑过的任何替代解决方案或功能。
## 额外上下文
添加任何其他关于功能请求的上下文或截图。

View File

@@ -15,6 +15,7 @@ on:
- ".gitignore"
- ".github/**"
- "!.github/workflows/build.yml"
- "!.github/workflows/test.yml"
pull_request:
branches: [main]
paths-ignore:
@@ -32,7 +33,28 @@ permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
- name: Run lint
run: npm run lint
build:
needs: test
runs-on: ${{ matrix.os }}
container: ${{ matrix.docker_image }}
@@ -46,7 +68,6 @@ jobs:
docker_image: "debian:12"
- package: rpm
docker_image: "almalinux:8"
steps:
- name: Install Build Dependencies
@@ -71,7 +92,7 @@ jobs:
node-version: 20
- name: Install Dependencies
run: |
run: |
npm install
- name: Download host-spawn
@@ -119,4 +140,4 @@ jobs:
files: |
artifacts/**/*.deb
artifacts/**/*.rpm
generate_release_notes: true
generate_release_notes: true

83
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
name: Test
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test -- --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
e2e-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run E2E tests
run: npm run test:e2e
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: playwright-report
path: playwright-report/
retention-days: 30
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check formatting
run: npm run format -- --check