run_tests
Execute standardized tests for projects, automatically enabling coverage mode when no specific test file pattern is provided.
Instructions
Run standardized tests for the project (with coverage when no pattern specified)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | No | Test file pattern to match (runs coverage mode if omitted) |
Implementation Reference
- src/tools/runTests.ts:6-24 (handler)The RunTestsTool class that extends BaseExecTool, providing the specific logic to build the test execution command based on input pattern and project config.class RunTestsTool extends BaseExecTool<TestRunnerOptions> { protected getActionName(): string { return 'Test'; } protected async buildCommand(args: TestRunnerOptions): Promise<string> { const { pattern } = args; const config = await loadProjectConfig(); // If no pattern specified, run tests with coverage if (!pattern) { return 'npm run test:coverage'; } // Otherwise run the configured test command with the pattern const command = config.testCommand ?? 'npm test'; return `${command} ${pattern}`; } }
- src/types/index.ts:50-52 (schema)Interface defining the input parameters for the run_tests tool: an optional pattern string to filter tests.export interface TestRunnerOptions { pattern?: string; }
- src/tools/runTests.ts:28-30 (handler)The exported handler function runTests that invokes the tool instance's execute method, serving as the entry point for the tool.export async function runTests(args: TestRunnerOptions): Promise<CallToolResult> { return tool.execute(args); }