mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
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:
@@ -46,7 +46,7 @@ const E2E_SETTINGS = {
|
|||||||
defaultSkipTests: true,
|
defaultSkipTests: true,
|
||||||
enableDependencyBlocking: true,
|
enableDependencyBlocking: true,
|
||||||
skipVerificationInAutoMode: false,
|
skipVerificationInAutoMode: false,
|
||||||
useWorktrees: false,
|
useWorktrees: true,
|
||||||
showProfilesOnly: false,
|
showProfilesOnly: false,
|
||||||
defaultPlanningMode: 'skip',
|
defaultPlanningMode: 'skip',
|
||||||
defaultRequirePlanApproval: false,
|
defaultRequirePlanApproval: false,
|
||||||
|
|||||||
@@ -78,9 +78,6 @@ export async function createTestGitRepo(tempDir: string): Promise<TestRepo> {
|
|||||||
const tmpDir = path.join(tempDir, `test-repo-${Date.now()}`);
|
const tmpDir = path.join(tempDir, `test-repo-${Date.now()}`);
|
||||||
fs.mkdirSync(tmpDir, { recursive: true });
|
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
|
// Use environment variables instead of git config to avoid affecting user's git config
|
||||||
// These env vars override git config without modifying it
|
// These env vars override git config without modifying it
|
||||||
const gitEnv = {
|
const gitEnv = {
|
||||||
@@ -91,13 +88,22 @@ export async function createTestGitRepo(tempDir: string): Promise<TestRepo> {
|
|||||||
GIT_COMMITTER_EMAIL: 'test@example.com',
|
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
|
// Create initial commit
|
||||||
fs.writeFileSync(path.join(tmpDir, 'README.md'), '# Test Project\n');
|
fs.writeFileSync(path.join(tmpDir, 'README.md'), '# Test Project\n');
|
||||||
await execAsync('git add .', { cwd: tmpDir, env: gitEnv });
|
await execAsync('git add .', { cwd: tmpDir, env: gitEnv });
|
||||||
await execAsync('git commit -m "Initial commit"', { cwd: tmpDir, env: gitEnv });
|
await execAsync('git commit -m "Initial commit"', { cwd: tmpDir, env: gitEnv });
|
||||||
|
|
||||||
// Create main branch explicitly
|
// Ensure branch is named 'main' (handles both new repos and older git versions)
|
||||||
await execAsync('git branch -M main', { cwd: tmpDir });
|
await execAsync('git branch -M main', { cwd: tmpDir, env: gitEnv });
|
||||||
|
|
||||||
// Create .automaker directories
|
// Create .automaker directories
|
||||||
const automakerDir = path.join(tmpDir, '.automaker');
|
const automakerDir = path.join(tmpDir, '.automaker');
|
||||||
|
|||||||
Reference in New Issue
Block a user