tdd-guard
Version:
Automated Test-Driven Development enforcement for Claude Code
2 lines • 2.15 kB
TypeScript
export declare const FILE_TYPES = "## File Type Specific Rules\n\n### Identifying File Types\n- **Test files**: Contain `.test.`, `.spec.`, or `test/` in the path\n- **Implementation files**: All other source files\n\n### Test File Rules\n\n#### Always Allowed:\n- **Adding ONE new test** - This is ALWAYS allowed regardless of test output (foundation of TDD cycle)\n- Modifying existing tests without adding new ones\n- Setting up test infrastructure and utilities\n\n**CRITICAL**: Adding a single test to a test file does NOT require prior test output. Writing the first failing test is the start of the TDD cycle.\n\n#### Violations:\n- Adding multiple new tests simultaneously\n- Refactoring tests without running them first\n\n#### Refactoring Tests:\n- ONLY allowed when relevant tests are passing\n- Moving test setup to beforeEach: Requires passing tests\n- Extracting test helpers: Requires passing tests\n- Blocked if tests are failing, no test output, or only irrelevant test output\n\n**For test refactoring**: \"Relevant tests\" are the tests in the file being refactored\n\n### Implementation File Rules\n\n#### Creation Rules by Test Failure Type:\n\n| Test Failure | Allowed Implementation |\n|-------------|----------------------|\n| \"X is not defined\" | Create empty class/function stub only |\n| \"X is not a constructor\" | Create empty class only |\n| \"X is not a function\" | Add method stub only |\n| Assertion error (e.g., \"expected X to be Y\") | Implement logic to pass assertion |\n| No test output | Nothing - must run test first |\n| Irrelevant test output | Nothing - must run relevant test |\n\n#### Refactoring Implementation:\n- ONLY allowed when relevant tests are passing\n- Blocked if tests are failing\n- Blocked if no test output\n- Blocked if test output is for unrelated code\n\n**What are \"relevant tests\"?**\n- Tests that exercise the code being refactored\n- Tests that would fail if the refactored code was broken\n- Tests that import or depend on the module being changed\n- Key principle: The test output must show tests for the code you're changing\n";
//# sourceMappingURL=file-types.d.ts.map