remove test
This commit is contained in:
68
AGENTS.md
68
AGENTS.md
@@ -22,17 +22,8 @@ npm run package:linux # Linux
|
||||
# 代码质量
|
||||
npm run lint # ESLint 检查
|
||||
npm run format # Prettier 格式化
|
||||
|
||||
# 测试
|
||||
npm test # 运行测试
|
||||
npm run test:watch # 监听模式
|
||||
npm run test:coverage # 测试覆盖率
|
||||
```
|
||||
|
||||
**重要**: 修改 `src/main/` 目录下的文件后,必须运行 `npm test` 确保测试通过。
|
||||
|
||||
**注意**: 仅修改 `src/renderer/`(前端/UI)或 `src/preload/` 文件时,不需要运行测试,只需确保类型检查通过(`npx tsc --noEmit`)即可。
|
||||
|
||||
## 2. 项目架构
|
||||
|
||||
```
|
||||
@@ -41,23 +32,19 @@ src/
|
||||
│ ├── index.ts # 入口,创建窗口
|
||||
│ ├── ipc-handlers.ts # IPC 处理器(所有通信入口)
|
||||
│ ├── storage.ts # 文件存储 + 密码加密
|
||||
│ ├── kintone-api.ts # Kintone REST API 封装
|
||||
│ └── __tests__/ # 主进程测试
|
||||
│ └── kintone-api.ts # Kintone REST API 封装
|
||||
├── preload/ # Preload 脚本
|
||||
│ ├── index.ts # 暴露 API 到渲染进程
|
||||
│ └── index.d.ts # 类型声明
|
||||
├── shared/ # 跨进程共享代码
|
||||
│ └── types/ # 共享类型定义
|
||||
├── renderer/ # React 渲染进程
|
||||
│ └── src/
|
||||
│ ├── main.tsx # React 入口
|
||||
│ ├── App.tsx # 根组件
|
||||
│ ├── components/ # React 组件
|
||||
│ ├── stores/ # Zustand Stores
|
||||
│ └── locales/ # i18n 翻译文件
|
||||
└── tests/ # 测试配置
|
||||
├── setup.ts # 测试环境设置
|
||||
└── mocks/ # Mock 文件
|
||||
└── renderer/ # React 渲染进程
|
||||
└── src/
|
||||
├── main.tsx # React 入口
|
||||
├── App.tsx # 根组件
|
||||
├── components/ # React 组件
|
||||
├── stores/ # Zustand Stores
|
||||
└── locales/ # i18n 翻译文件
|
||||
```
|
||||
|
||||
### 数据流
|
||||
@@ -139,12 +126,14 @@ type Result<T> = { success: true; data: T } | { success: false; error: string };
|
||||
**UI Kit 优先使用 LobeHub UI** (`@lobehub/ui`),其次使用 Ant Design 6 + antd-style:
|
||||
|
||||
```typescript
|
||||
import { Button } from '@lobehub/ui';
|
||||
import { createStyles } from 'antd-style';
|
||||
import { Button } from "@lobehub/ui";
|
||||
import { createStyles } from "antd-style";
|
||||
|
||||
// antd-style 仅用于自定义样式
|
||||
export const useStyles = createStyles(({ token, css }) => ({
|
||||
container: css`padding: ${token.paddingLG}px;`
|
||||
container: css`
|
||||
padding: ${token.paddingLG}px;
|
||||
`,
|
||||
}));
|
||||
```
|
||||
|
||||
@@ -217,34 +206,3 @@ eval "$(fnm env --use-on-cd)" && npm run dev
|
||||
3. Explain the reasoning and benefits
|
||||
4. If significant, ask user for confirmation before implementing
|
||||
5. Update related documentation after implementation
|
||||
|
||||
## 14. 测试规范
|
||||
|
||||
### 测试框架
|
||||
|
||||
使用 **Vitest** 作为测试框架,与 Vite 原生集成。
|
||||
|
||||
### 测试文件结构
|
||||
|
||||
```
|
||||
src/main/__tests__/ # 主进程测试
|
||||
tests/
|
||||
├── setup.ts # 全局测试设置
|
||||
└── mocks/
|
||||
└── electron.ts # Electron API Mocks
|
||||
```
|
||||
|
||||
### 测试要求
|
||||
|
||||
1. **修改 `src/main/` 目录下的文件后,必须运行 `npm test` 确保测试通过**
|
||||
2. 新增 API 功能时,应在 `src/main/__tests__/` 中添加对应测试
|
||||
3. 测试文件命名:`*.test.ts`
|
||||
|
||||
### Mock Electron API
|
||||
|
||||
测试中需要 Mock Electron 的 API(如 `safeStorage`、`app` 等),已在 `tests/mocks/electron.ts` 中提供。
|
||||
|
||||
```typescript
|
||||
// tests/setup.ts 中自动 Mock
|
||||
vi.mock("electron", () => import("./mocks/electron"));
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user