This directory contains tests for the Task Master CLI. The tests are organized into different categories to ensure comprehensive test coverage.
unit/: Unit tests for individual functions and componentsintegration/: Integration tests for testing interactions between componentse2e/: End-to-end tests for testing complete workflowsfixtures/: Test fixtures and sample data
To run all tests:
npm testTo run tests in watch mode (for development):
npm run test:watchTo run tests with coverage reporting:
npm run test:coverageUnit tests focus on testing individual functions and components in isolation. These tests should be fast and should mock external dependencies.
Integration tests focus on testing interactions between components. These tests ensure that components work together correctly.
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 provide sample data for tests. Fixtures should be small, focused, and representative of real-world data.
For external dependencies like file system operations and API calls, we use mocking to isolate the code being tested.
- File system operations: Use
mock-fsto mock the file system - API calls: Use Jest's mocking capabilities to mock API responses
We aim for at least 80% test coverage for all code paths. Coverage reports can be generated with:
npm run test:coverage