fix: enhance test stability and error handling for worktree operations

- Updated feature lifecycle tests to ensure the correct modal close button is selected, improving test reliability.
- Refactored worktree integration tests for better readability and maintainability by formatting function calls and assertions.
- Introduced error handling improvements in the server routes to suppress unnecessary ENOENT logs for optional files, reducing noise in test outputs.
- Enhanced logging for worktree errors to conditionally suppress expected errors in test environments, improving clarity in error reporting.
This commit is contained in:
Cody Seibert
2025-12-16 18:44:52 -05:00
parent ebc99d06eb
commit 360b7ebe08
6 changed files with 320 additions and 80 deletions

View File

@@ -96,6 +96,9 @@ export async function createTestGitRepo(tempDir: string): Promise<TestRepo> {
const featuresDir = path.join(automakerDir, "features");
fs.mkdirSync(featuresDir, { recursive: true });
// Create empty categories.json to avoid ENOENT errors in tests
fs.writeFileSync(path.join(automakerDir, "categories.json"), "[]");
return {
path: tmpDir,
cleanup: async () => {
@@ -324,6 +327,11 @@ export async function setupProjectWithPath(page: Page, projectPath: string): Pro
chatHistoryOpen: false,
maxConcurrency: 3,
aiProfiles: [],
useWorktrees: true, // Enable worktree feature for tests
currentWorktreeByProject: {
[pathArg]: { path: null, branch: "main" }, // Initialize to main branch
},
worktreesByProject: {},
},
version: 0,
};