feat(tests): implement test runner functionality with API integration

- Added Test Runner Service to manage test execution processes for worktrees.
- Introduced endpoints for starting and stopping tests, and retrieving test logs.
- Created UI components for displaying test logs and managing test sessions.
- Integrated test runner events for real-time updates in the UI.
- Updated project settings to include configurable test commands.

This enhancement allows users to run tests directly from the UI, view logs in real-time, and manage test sessions effectively.
This commit is contained in:
Shirone
2026-01-21 15:45:33 +01:00
parent c3e7e57968
commit afa93dde0d
28 changed files with 3322 additions and 19 deletions

View File

@@ -2063,6 +2063,52 @@ function createMockWorktreeAPI(): WorktreeAPI {
},
};
},
// Test runner methods
startTests: async (
worktreePath: string,
options?: { projectPath?: string; testFile?: string }
) => {
console.log('[Mock] Starting tests:', { worktreePath, options });
return {
success: true,
result: {
sessionId: 'mock-session-123',
worktreePath,
command: 'npm run test',
status: 'running' as const,
testFile: options?.testFile,
message: 'Tests started (mock)',
},
};
},
stopTests: async (sessionId: string) => {
console.log('[Mock] Stopping tests:', { sessionId });
return {
success: true,
result: {
sessionId,
message: 'Tests stopped (mock)',
},
};
},
getTestLogs: async (worktreePath?: string, sessionId?: string) => {
console.log('[Mock] Getting test logs:', { worktreePath, sessionId });
return {
success: false,
error: 'No test sessions found (mock)',
};
},
onTestRunnerEvent: (callback) => {
console.log('[Mock] Subscribing to test runner events');
// Return unsubscribe function
return () => {
console.log('[Mock] Unsubscribing from test runner events');
};
},
};
}