Files
claude-task-master/tests
Ralph Khreish 58b417a8ce Add complexity score to task (#528)
* feat: added complexity score handling to list tasks

* feat: added handling for complexity score in find task by id

* test: remove console dir

* chore: add changeset

* format: fixed formatting issues

* ref: reorder imports

* feat: updated handling for findTaskById to take complexityReport as input

* test: fix findTaskById complexity report testcases

* fix: added handling for complexity report path

* chore: add changeset

* fix: moved complexity report handling to list tasks rather than list tasks direct

* fix: add complexity handling to next task in list command

* fix: added handling for show cli

* fix: fixed next cli command handling

* fix: fixed handling for complexity report path in mcp

* feat: added handling to get-task

* feat: added handling for next-task in mcp

* feat: add handling for report path override

* chore: remove unecessary changeset

* ref: remove unecessary comments

* feat: update list and find next task

* fix: fixed running tests

* fix: fixed findTaskById

* fix: fixed findTaskById and tests

* fix: fixed addComplexityToTask util

* fix: fixed mcp server project root input

* chore: cleanup

---------

Co-authored-by: Shrey Paharia <shreypaharia@gmail.com>
2025-05-16 23:24:25 +02:00
..
2025-05-16 23:24:25 +02:00
2025-04-09 00:30:05 +02: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