feat: update E2E fixture settings and improve test repository initialization

- Changed the E2E settings to enable the use of worktrees for better test isolation.
- Modified the test repository initialization to explicitly set the initial branch to 'main', ensuring compatibility across different git versions and avoiding CI environment discrepancies.
This commit is contained in:
webdevcody
2026-01-07 23:10:02 -05:00
parent 8992f667c7
commit dc264bd164
2 changed files with 12 additions and 6 deletions

View File

@@ -46,7 +46,7 @@ const E2E_SETTINGS = {
defaultSkipTests: true,
enableDependencyBlocking: true,
skipVerificationInAutoMode: false,
useWorktrees: false,
useWorktrees: true,
showProfilesOnly: false,
defaultPlanningMode: 'skip',
defaultRequirePlanApproval: false,

View File

@@ -78,9 +78,6 @@ export async function createTestGitRepo(tempDir: string): Promise<TestRepo> {
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<TestRepo> {
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');