Skip to main content

review-feature-tests

Reviews the test coverage of a feature in Open Collective and proposes a plan to improve coverage when needed. Use when asked to review tests for a feature, assess test coverage, find coverage gaps, or plan new tests. Covers opencollective-frontend (Jest), opencollective-api (Mocha), opencollective-pdf (Vitest), and opencollective-rest (Jest).

跳到安装

来源信息

仓库
opencollective/monorepo
最近来源活动
2026年3月18日 07:52
检测到的 SKILL.md 语言
英语
星标
3
分支
3

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
review-feature-tests
disable-model-invocation
true
description
Reviews the test coverage of a feature in Open Collective and proposes a plan to improve coverage when needed. Use when asked to review tests for a feature, assess test coverage, find coverage gaps, or plan new tests. Covers opencollective-frontend (Jest), opencollective-api (Mocha), opencollective-pdf (Vitest), and opencollective-rest (Jest).
# Review Feature Tests ## Overview Analyzes test coverage for a given feature or module, identifies gaps, and produces a prioritized improvement plan. Works across all Open Collective services. ## Workflow ### 1. Identify the Feature and Its Scope Determine the feature to review. It may be: - **Path-based**: e.g. `opencollective-api/server/graphql/v2/mutation/ExpenseMutations` - **Keyword-based**: e.g. "expense approval", "virtual cards", "host dashboard" - **Component-based**: e.g. `opencollective-frontend/components/edit-collective/sections/ReceivingMoney` Map the feature to the relevant project: - **opencollective-frontend**: Jest (`components/`, `lib/`, `pages/`), Cypress E2E (`test/cypress/`) - **opencollective-api**: Mocha (`test/server/`), tests mirror source structure - **opencollective-pdf**: Vitest - **opencollective-rest**: Jest ### 2. Discover Related Tests Use the discovery script to find tests that cover the feature: ```bash ./.agents/skills/review-feature-tests/scripts/list-feature-tests.sh <project> <path-or-keyword> ``` Examples: - `list-feature-tests.sh opencollective-api server/graphql/v2/mutation/ExpenseMutations` - `list-feature-tests.sh opencollective-frontend ReceivingMoney` - `list-feature-tests.sh opencollective-api expense` Also search manually when needed: ```bash # API: tests mirror source; ExpenseMutations → test/server/graphql/v2/mutation/ExpenseMutations.test.* # Frontend: *.test.tsx alongside components or in __tests__ grep -r "keyword" opencollective-api/test --include="*.test.*" -l ``` ### 3. Run Tests and Coverage Use `./scripts/test.sh` for targeted test runs: ```bash ./scripts/test.sh opencollective-api/test/server/graphql/v2/mutation/ExpenseMutations.test.js ./scripts/test.sh opencollective-frontend/components/edit-collective/sections/ReceivingMoney.test.tsx ``` For coverage, run in the project directory: ```bash cd opencollective-api && npm run test:coverage -- --grep "Expense" cd opencollective-frontend && npm run test:coverage -- components/edit-collective ``` Or use the coverage script: ```bash ./.agents/skills/review-feature-tests/scripts/run-feature-coverage.sh <project> [path-filter] ``` ### 4. Analyze Coverage Gaps Read the implementation and test files. Identify: - **Untested code paths**: Branches, error handlers, edge cases - **Missing scenarios**: Happy path vs. error paths, permissions, validation - **Integration gaps**: GraphQL resolvers without loader tests, API without route tests - **E2E gaps**: Critical flows not covered by Cypress Use coverage reports (`coverage/lcov-report/index.html` or terminal output) to see line/branch coverage. ### 5. Propose Improvement Plan Produce a structured plan: 1. **Priority 1 – Critical**: Core business logic, security-sensitive code, payment flows 2. **Priority 2 – Important**: Error handling, validation, permissions 3. **Priority 3 – Nice to have**: Edge cases, refactor safety nets For each gap: - **Location**: File and function/path - **Gap**: What is not tested - **Suggested test**: Unit, integration, or E2E; describe the scenario - **Effort**: Low / Medium / High ## Test Frameworks Reference | Project | Framework | Test Dir | Pattern | | ----------------------- | --------- | ------------------------- | ----------------------------------------- | | opencollective-frontend | Jest | components/, lib/, pages/ | `*.test.tsx`, `__tests__/` | | opencollective-frontend | Cypress | test/cypress/integration/ | `*.test.js` | | opencollective-api | Mocha | test/server/ | Mirrors source, `*.test.ts` or `.test.js` | | opencollective-pdf | Vitest | test/ | `*.test.ts` | | opencollective-rest | Jest | test/ | `*.test.ts` | ## Scripts ### `scripts/list-feature-tests.sh` Lists test files related to a feature. Run from workspace root. ```bash ./.agents/skills/review-feature-tests/scripts/list-feature-tests.sh <project> <path-or-keyword> ``` ### `scripts/run-feature-coverage.sh` Runs coverage for a project, optionally filtered by path. Run from workspace root. ```bash ./.agents/skills/review-feature-tests/scripts/run-feature-coverage.sh <project> [path-filter] ```
在 GitHub 查看