-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or requestpriority:highHigh priority itemHigh priority item
Description
Summary
The codebase currently has no unit tests for the src/ folder. Test coverage analysis shows:
- 0 test files in src/
- 154 untested source files
- 0% test coverage
Scope
Priority 1: Core Services (High Value)
Services with complex logic that would benefit most from testing:
-
code-quality-service.ts- Complexity analysis, scoring algorithm -
security-service.ts- Pattern matching, vulnerability detection -
architecture-service.ts- Glob pattern matching, validation rules -
documentation-service.ts- JSDoc parsing, coverage calculation -
performance-analyzer.ts- Anti-pattern detection -
test-coverage/- Test parsing, smell detection
Priority 2: MCP Handlers (21 handlers)
- Analysis handlers (7): architecture, ci-pipeline, code-quality, documentation, impact-analysis, performance-analysis, test-coverage
- Project handlers (7): constitution, danger-zone, dependency, environment, onboard, release, resource
- Workflow handlers (4): execution, planning, spec, status
- Other handlers (3): checkpoint, memory, security, team-knowledge, pr-review
Priority 3: Infrastructure
-
registry/tool-registry.ts- Tool discovery, schema generation -
decorators/- @mcptool, @MCPParam decorators -
server.ts- MCP server initialization
Suggested Approach
- Setup: Configure Vitest (faster than Jest, native ESM support)
- Test Structure: Mirror src/ structure in tests/
- Mocking: Use dependency injection for testable services
- Coverage Target: Start with 60%, aim for 80%
Test Framework Setup
npm install -D vitest @vitest/coverage-v8// vitest.config.ts
export default {
test: {
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.d.ts']
}
}
}Example Test Structure
tests/
├── core/
│ └── mcp/
│ ├── services/
│ │ ├── code-quality-service.test.ts
│ │ ├── security-service.test.ts
│ │ └── architecture-service.test.ts
│ ├── handlers/
│ │ └── analysis/
│ │ └── code-quality-handler.test.ts
│ └── registry/
│ └── tool-registry.test.ts
Acceptance Criteria
- Vitest configured with coverage reporting
- At least 10 core service test files created
- At least 5 handler test files created
- Minimum 60% code coverage achieved
- CI pipeline runs tests on PR
-
npm testcommand works
References
- Test coverage analysis tool:
test-coverage-analyze - Current untested files: 154
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:highHigh priority itemHigh priority item