Problem
The commands layer has 28.18% statement coverage. 9 of 11 command files have 0% coverage:
| Command File |
Coverage |
Risk |
issues.ts |
50.53% |
High — complex flag validation untested |
auth.ts |
81.81% |
Low |
comments.ts |
0% |
Medium |
cycles.ts |
0% |
Medium |
documents.ts |
0% |
Medium — most logic of any read-only command |
files.ts |
0% |
Medium |
labels.ts |
0% |
Low — simple pass-through |
milestones.ts |
0% |
Medium |
projects.ts |
0% |
Low — simple pass-through |
teams.ts |
0% |
Low — simple pass-through |
users.ts |
0% |
Low — simple pass-through |
The highest-risk untested code is the issues update flag validation:
- Mutual exclusivity:
--parent-ticket vs --clear-parent-ticket
--label-mode requires --labels
--clear-labels conflicts with --labels and --label-mode
- Relation flag mutual exclusivity (5 flags, only 1 allowed)
Approach
Command tests should mock createContext() to return mock gql/sdk clients, then verify:
- Flag validation — invalid combinations throw before any API call
- Resolver calls — correct identifiers passed to resolvers
- Service calls — correct UUIDs and inputs passed to services
- Output —
outputSuccess() called with service result
Test template
vi.mock("../../src/common/context.js", () => ({
createContext: vi.fn(() => ({
gql: { request: vi.fn() },
sdk: { sdk: { teams: vi.fn(), issues: vi.fn() } },
})),
}));
Priority order
issues update — highest complexity, highest risk
issues create — many optional flags with dependencies
documents — has --issue attachment logic, URL extraction
cycles — --window flag logic
milestones — project-scoped resolution
- Remaining simple commands
Acceptance criteria
Problem
The commands layer has 28.18% statement coverage. 9 of 11 command files have 0% coverage:
issues.tsauth.tscomments.tscycles.tsdocuments.tsfiles.tslabels.tsmilestones.tsprojects.tsteams.tsusers.tsThe highest-risk untested code is the
issues updateflag validation:--parent-ticketvs--clear-parent-ticket--label-moderequires--labels--clear-labelsconflicts with--labelsand--label-modeApproach
Command tests should mock
createContext()to return mockgql/sdkclients, then verify:outputSuccess()called with service resultTest template
Priority order
issues update— highest complexity, highest riskissues create— many optional flags with dependenciesdocuments— has--issueattachment logic, URL extractioncycles—--windowflag logicmilestones— project-scoped resolutionAcceptance criteria
issues updateflag validation: all mutual exclusivity checks testedissues createrequired flag (--team) testednpm run test:coveragereports improvement