testing-clickup-cli
关于
This skill manages testing for the clickup-cli project, handling both unit tests with mocked dependencies and end-to-end tests against a live ClickUp workspace. It's used for running test suites, debugging failures, and setting up test fixtures or data. Developers should use it when working on test coverage, verifying CLI behavior, or preparing the test environment.
快速安装
Claude Code
推荐npx skills add krodak/clickup-cli -a claude-code/plugin add https://github.com/krodak/clickup-cligit clone https://github.com/krodak/clickup-cli.git ~/.claude/skills/testing-clickup-cli在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Test Suite Overview
| Suite | Command | Files | What it tests |
|---|---|---|---|
| Unit | npm test | tests/unit/**/*.test.ts | All commands, API client, formatters, config. Mocks ClickUpClient. |
| E2E | npm run test:e2e | tests/e2e/**/*.e2e.ts | Real API calls against a live ClickUp workspace. |
Unit tests run in CI. E2E tests require CLICKUP_API_TOKEN in .env.test and are not part of CI.
Running Tests
npm test # all unit tests
npm test -- tests/unit/commands/ # just command tests
npm test -- -t "sprint" # filter by test name
npm run test:e2e # e2e tests (needs .env.test)
The unit test global setup runs npm run build before tests start.
E2E Test Workspace
Tests run against the personal ClickUp workspace (profile: personal).
Space: E2E Tests (90166622768)
Pre-populated with test fixtures:
| Fixture | What it contains |
|---|---|
| Sprints folder | 3 sprint lists with (M/DD - M/DD) date ranges. Sprint 2 is "current". |
| Backlog list | General tasks for CRUD testing. E2E lifecycle tests create/delete tasks here. |
| Tasks | 11 tasks with varied statuses, priorities, assignees, due dates, tags. |
| Subtasks | 3 subtasks under "Implement user authentication". |
| Checklist | "CI Steps" with 5 items (3 resolved). |
| Tags | backend, frontend, security, design, bug. |
| Comments | 2 comments on the auth task. |
| Dependencies | "Design landing page" depends on "Set up CI pipeline". |
| Overdue task | "Fix login redirect bug" in Sprint 1 with past due date. |
Space: ClickUp CLI (90166622769)
Project tracking space. Not used for tests - used for tracking releases and features.
E2E Test Patterns
Lifecycle tests (tests/e2e/lifecycle.e2e.ts)
These create test data, verify operations, and clean up:
| Suite | Tests | Coverage |
|---|---|---|
| Task lifecycle | 13 | Create, read, update, subtask, comment, checklist, delete, confirm gone |
| Tag lifecycle | 4 | Add tag, verify, remove, verify removed |
| Time tracking | 5 | Start timer, check running, stop, log entry, list entries |
Each suite uses beforeAll to find the Backlog list and afterAll to clean up created tasks.
API tests (tests/e2e/api.e2e.ts)
Tests API client methods directly: getSpaces, getLists, getTask, sprint detection.
Unit Test Patterns
Mocking ClickUpClient
Every command test mocks the API client with vi.mock:
const mockGetTask = vi.fn().mockResolvedValue({ id: 't1', name: 'Task' })
vi.mock('../../../src/api.js', () => ({
ClickUpClient: vi.fn().mockImplementation(function () {
return { getTask: mockGetTask }
}),
}))
The function keyword (not arrow) is required for Vitest 4's new semantics.
Testing command functions
Commands export pure functions. Tests import and call them directly:
const { updateTask } = await import('../../../src/commands/update.js')
await updateTask({ apiToken: 'pk_t', teamId: 'team1' }, 't1', { status: 'done' })
expect(mockUpdateTask).toHaveBeenCalledWith('t1', { status: 'done' })
Metadata sync test
tests/unit/commands/completion.test.ts verifies that:
- Every command registered in Commander is listed in
src/commands/metadata.ts - The
docs/commands.mdquick reference section matches what metadata generates
If you add a new command, you MUST add it to metadata.ts. If you add new flags, add them too. Then run node --import tsx scripts/sync-command-docs.ts to regenerate the docs.
Adding New Tests
New unit test
- Create
tests/unit/commands/<name>.test.ts - Mock
ClickUpClientwith the methods your command uses - Test happy path, error cases, edge cases
- Run
npm test -- tests/unit/commands/<name>.test.ts
New e2e test
- Add to
tests/e2e/lifecycle.e2e.tsor create a new*.e2e.tsfile - Use the Backlog list in E2E Tests space for creating test data
- Always clean up: delete created tasks/checklists in
afterAll - Use
describe.skipIf(!TOKEN)to skip when no API token is set - Run
npm run test:e2e
Config for E2E
# .env.test (gitignored)
CLICKUP_API_TOKEN=pk_... # personal workspace token
Copy from .env.test.example and fill in your token.
GitHub 仓库
相关推荐技能
evaluating-llms-harness
测试该Skill通过60+个学术基准测试(如MMLU、GSM8K等)评估大语言模型质量,适用于模型对比、学术研究及训练进度追踪。它支持HuggingFace、vLLM和API接口,被EleutherAI等行业领先机构广泛采用。开发者可通过简单命令行快速对模型进行多任务批量评估。
cloudflare-cron-triggers
测试这个Claude Skill提供了关于Cloudflare Cron Triggers的完整知识库,用于通过cron表达式定时执行Workers。它支持配置周期性任务、维护作业和自动化工作流,并能处理常见的cron触发错误。开发者可以用它来设置定时任务、测试cron处理器,并集成Workflows和Green Compute功能。
webapp-testing
测试该Skill为开发者提供了基于Playwright的本地Web应用测试工具集,支持自动化测试前端功能、调试UI行为、捕获屏幕截图和查看浏览器日志。它包含管理服务器生命周期的辅助脚本,可直接作为黑盒工具运行而无需阅读源码。适用于需要快速验证本地Web应用界面和交互功能的开发场景。
finishing-a-development-branch
测试这个Skill用于开发分支完成后的集成决策,当代码实现完成且测试通过时,它会引导开发者选择合适的工作流。它首先验证测试状态,然后提供合并、创建PR或清理等结构化选项。核心价值在于确保代码质量的同时,标准化分支收尾流程。
