From 12b4aa7e5954ae043c53e8f9a3765ff378c1280a Mon Sep 17 00:00:00 2001 From: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com> Date: Thu, 17 Jul 2025 20:45:26 +0300 Subject: [PATCH] fix: clear-subtasks and complexity report e2e test --- tests/e2e/tests/commands/clear-subtasks.test.js | 6 ++++-- tests/e2e/tests/commands/complexity-report.test.js | 14 +++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/e2e/tests/commands/clear-subtasks.test.js b/tests/e2e/tests/commands/clear-subtasks.test.js index 439d28c3..1e41fefb 100644 --- a/tests/e2e/tests/commands/clear-subtasks.test.js +++ b/tests/e2e/tests/commands/clear-subtasks.test.js @@ -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')); diff --git a/tests/e2e/tests/commands/complexity-report.test.js b/tests/e2e/tests/commands/complexity-report.test.js index c5f34d02..c6b236ee 100644 --- a/tests/e2e/tests/commands/complexity-report.test.js +++ b/tests/e2e/tests/commands/complexity-report.test.js @@ -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 () => {