三层质量保障闭环: package.json: - 新增 typecheck / test:unit / test:smoke / test:e2e / test / prepare 脚本 - 新增 lint-staged 配置(仅对暂存 .ts/.tsx 文件运行 eslint --fix) - 新增 devDependencies: husky, lint-staged, tsx .husky/pre-commit: - 依次执行 lint-staged → tsc --noEmit → 单元测试 - 任一步骤失败即阻止提交 src/__tests__/e2e/smoke.spec.ts: - 5 个 Playwright @smoke 测试覆盖核心路由 (/, /chat, /plugins, /plugins/mcp, /settings) - 检查 HTTP 状态、Next.js 错误覆盖层、标题、console 错误 - 复用已有 helpers (goToChat, goToPlugins, goToMCP, goToSettings, collectConsoleErrors, filterCriticalErrors) .github/workflows/build.yml: - 新增 lint-test job (ubuntu-latest): lint → typecheck → unit tests - 新增 pull_request 触发器 - 三个 build job 添加 needs: [lint-test],lint-test 失败则不构建 - lint 步骤暂设 continue-on-error(存量 4 个 lint error 待修复) CLAUDE.md: - 新增"自检命令"区块,说明 test / test:smoke / test:e2e 用途 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 lines
77 B
Plaintext
4 lines
77 B
Plaintext
npx lint-staged
|
|
npx tsc --noEmit
|
|
npx tsx --test src/__tests__/unit/*.test.ts
|