diff --git a/apps/ui/scripts/setup-e2e-fixtures.mjs b/apps/ui/scripts/setup-e2e-fixtures.mjs index d0d604f4..e6009fd4 100644 --- a/apps/ui/scripts/setup-e2e-fixtures.mjs +++ b/apps/ui/scripts/setup-e2e-fixtures.mjs @@ -46,7 +46,7 @@ const E2E_SETTINGS = { defaultSkipTests: true, enableDependencyBlocking: true, skipVerificationInAutoMode: false, - useWorktrees: false, + useWorktrees: true, showProfilesOnly: false, defaultPlanningMode: 'skip', defaultRequirePlanApproval: false, diff --git a/apps/ui/tests/utils/git/worktree.ts b/apps/ui/tests/utils/git/worktree.ts index 0a80fce1..110813ea 100644 --- a/apps/ui/tests/utils/git/worktree.ts +++ b/apps/ui/tests/utils/git/worktree.ts @@ -78,9 +78,6 @@ export async function createTestGitRepo(tempDir: string): Promise { const tmpDir = path.join(tempDir, `test-repo-${Date.now()}`); fs.mkdirSync(tmpDir, { recursive: true }); - // Initialize git repo - await execAsync('git init', { cwd: tmpDir }); - // Use environment variables instead of git config to avoid affecting user's git config // These env vars override git config without modifying it const gitEnv = { @@ -91,13 +88,22 @@ export async function createTestGitRepo(tempDir: string): Promise { GIT_COMMITTER_EMAIL: 'test@example.com', }; + // Initialize git repo with explicit branch name to avoid CI environment differences + // Use -b main to set initial branch (git 2.28+), falling back to branch -M for older versions + try { + await execAsync('git init -b main', { cwd: tmpDir, env: gitEnv }); + } catch { + // Fallback for older git versions that don't support -b flag + await execAsync('git init', { cwd: tmpDir, env: gitEnv }); + } + // Create initial commit fs.writeFileSync(path.join(tmpDir, 'README.md'), '# Test Project\n'); await execAsync('git add .', { cwd: tmpDir, env: gitEnv }); await execAsync('git commit -m "Initial commit"', { cwd: tmpDir, env: gitEnv }); - // Create main branch explicitly - await execAsync('git branch -M main', { cwd: tmpDir }); + // Ensure branch is named 'main' (handles both new repos and older git versions) + await execAsync('git branch -M main', { cwd: tmpDir, env: gitEnv }); // Create .automaker directories const automakerDir = path.join(tmpDir, '.automaker');