mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
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:
@@ -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');
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user