fix: clear-subtasks and complexity report e2e test

This commit is contained in:
Ralph Khreish
2025-07-17 20:45:26 +03:00
parent 2577c95e65
commit 12b4aa7e59
2 changed files with 11 additions and 9 deletions

View File

@@ -131,7 +131,8 @@ describe('task-master clear-subtasks command', () => {
// Verify success
expect(result).toHaveExitCode(0);
expect(result.stdout).toContain('Clearing Subtasks');
expect(result.stdout).toContain('Successfully cleared subtasks from 2 task(s)');
// The success message appears in a decorative box with extra spaces
expect(result.stdout).toMatch(/Successfully\s+cleared\s+subtasks\s+from\s+2\s+task\(s\)/i);
// Read updated tasks
const updatedTasks = JSON.parse(readFileSync(tasksPath, 'utf8'));
@@ -152,7 +153,8 @@ describe('task-master clear-subtasks command', () => {
// Verify success
expect(result).toHaveExitCode(0);
expect(result.stdout).toContain('Clearing Subtasks');
expect(result.stdout).toContain('Successfully cleared subtasks from');
// The success message appears in a decorative box with extra spaces
expect(result.stdout).toMatch(/Successfully\s+cleared\s+subtasks\s+from/i);
// Read updated tasks
const updatedTasks = JSON.parse(readFileSync(tasksPath, 'utf8'));

View File

@@ -271,9 +271,10 @@ describe('task-master complexity-report command', () => {
// Should show distribution
expect(result).toHaveExitCode(0);
expect(result.stdout).toContain('Complexity Distribution');
expect(result.stdout).toContain('Low (1-4): 3 tasks');
expect(result.stdout).toContain('Medium (5-7): 5 tasks');
expect(result.stdout).toContain('High (8-10): 2 tasks');
// The distribution text appears with percentages in a decorative box
expect(result.stdout).toMatch(/Low\s*\(1-4\):\s*3\s*tasks/);
expect(result.stdout).toMatch(/Medium\s*\(5-7\):\s*5\s*tasks/);
expect(result.stdout).toMatch(/High\s*\(8-10\):\s*2\s*tasks/);
});
it('should handle malformed report gracefully', async () => {
@@ -286,10 +287,9 @@ describe('task-master complexity-report command', () => {
// The command exits silently when JSON parsing fails
expect(result).toHaveExitCode(0);
// Output shows error message and tag footer
const expected = result.stdout.trim();
expect(expected).toContain('🏷️ tag: master');
expect(expected).toContain('[ERROR]');
expect(expected).toContain('Error reading complexity report');
expect(result.stdout).toContain('🏷️ tag: master');
expect(result.stdout).toContain('[ERROR]');
expect(result.stdout).toContain('Error reading complexity report');
});
it('should display report generation time', async () => {