mirror of
https://github.com/eyaltoledano/claude-task-master.git
synced 2025-06-27 00:29:58 +00:00

Refactored `config-manager.js` to handle different execution contexts (CLI vs. MCP) and fixed related Jest tests. - Modified `readConfig` and `writeConfig` to accept an optional `explicitRoot` parameter, allowing explicit path specification (e.g., from MCP) while retaining automatic project root finding for CLI usage. - Updated getter/setter functions (`getMainProvider`, `setMainModel`, etc.) to accept and propagate the `explicitRoot`. - Resolved Jest testing issues for dynamic imports by using `jest.unstable_mockModule` for `fs` and `chalk` dependencies *before* the dynamic `import()`. - Corrected console error assertions in tests to match exact logged messages. - Updated `.cursor/rules/tests.mdc` with guidelines for `jest.unstable_mockModule` and precise console assertions.
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
export default {
|
|
// Use Node.js environment for testing
|
|
testEnvironment: 'node',
|
|
|
|
// Automatically clear mock calls between every test
|
|
clearMocks: true,
|
|
|
|
// Indicates whether the coverage information should be collected while executing the test
|
|
collectCoverage: false,
|
|
|
|
// The directory where Jest should output its coverage files
|
|
coverageDirectory: 'coverage',
|
|
|
|
// A list of paths to directories that Jest should use to search for files in
|
|
roots: ['<rootDir>/tests'],
|
|
|
|
// The glob patterns Jest uses to detect test files
|
|
testMatch: ['**/__tests__/**/*.js', '**/?(*.)+(spec|test).js'],
|
|
|
|
// Transform files
|
|
transform: {},
|
|
|
|
// Disable transformations for node_modules
|
|
transformIgnorePatterns: ['/node_modules/'],
|
|
|
|
// Set moduleNameMapper for absolute paths
|
|
moduleNameMapper: {
|
|
'^@/(.*)$': '<rootDir>/$1'
|
|
},
|
|
|
|
// Setup module aliases
|
|
moduleDirectories: ['node_modules', '<rootDir>'],
|
|
|
|
// Configure test coverage thresholds
|
|
coverageThreshold: {
|
|
global: {
|
|
branches: 80,
|
|
functions: 80,
|
|
lines: 80,
|
|
statements: 80
|
|
}
|
|
},
|
|
|
|
// Generate coverage report in these formats
|
|
coverageReporters: ['text', 'lcov'],
|
|
|
|
// Verbose output
|
|
verbose: true,
|
|
|
|
// Setup file
|
|
setupFilesAfterEnv: ['<rootDir>/tests/setup.js']
|
|
};
|