Files
claude-task-master/tests
Eyal Toledano 9e19b54518 feat: Enhance testing, CLI flag validation, and AI capabilities
This commit introduces several significant improvements:

- **Enhanced Unit Testing:**  Vastly improved unit tests for the  module, covering core functions, edge cases, and error handling.  Simplified test functions and comprehensive mocking were implemented for better isolation and reliability. Added new section to tests.mdc detailing reliable testing techniques.

- **CLI Kebab-Case Flag Enforcement:**  The CLI now enforces kebab-case for flags, providing helpful error messages when camelCase is used. This improves consistency and user experience.

- **AI Enhancements:**
    - Enabled 128k token output for Claude 3.7 Sonnet by adding the  header.
    - Added a new task to  to document this change and its testing strategy.
    - Added unit tests to verify the Anthropic client configuration.
    - Added  and  utility functions.

- **Improved Test Coverage:** Added tests for the new CLI flag validation logic.
2025-03-25 17:20:09 -04:00
..
2025-03-24 17:33:57 -04:00

Task Master Test Suite

This directory contains tests for the Task Master CLI. The tests are organized into different categories to ensure comprehensive test coverage.

Test Structure

  • unit/: Unit tests for individual functions and components
  • integration/: Integration tests for testing interactions between components
  • e2e/: End-to-end tests for testing complete workflows
  • fixtures/: Test fixtures and sample data

Running Tests

To run all tests:

npm test

To run tests in watch mode (for development):

npm run test:watch

To run tests with coverage reporting:

npm run test:coverage

Testing Approach

Unit Tests

Unit tests focus on testing individual functions and components in isolation. These tests should be fast and should mock external dependencies.

Integration Tests

Integration tests focus on testing interactions between components. These tests ensure that components work together correctly.

End-to-End Tests

End-to-end tests focus on testing complete workflows from a user's perspective. These tests ensure that the CLI works correctly as a whole.

Test Fixtures

Test fixtures provide sample data for tests. Fixtures should be small, focused, and representative of real-world data.

Mocking

For external dependencies like file system operations and API calls, we use mocking to isolate the code being tested.

  • File system operations: Use mock-fs to mock the file system
  • API calls: Use Jest's mocking capabilities to mock API responses

Test Coverage

We aim for at least 80% test coverage for all code paths. Coverage reports can be generated with:

npm run test:coverage