diff --git a/tests/e2e/combined-diff-scroll-restore.spec.ts b/tests/e2e/combined-diff-scroll-restore.spec.ts index 496bead3db6..3424b611f23 100644 --- a/tests/e2e/combined-diff-scroll-restore.spec.ts +++ b/tests/e2e/combined-diff-scroll-restore.spec.ts @@ -1,8 +1,8 @@ -import { execFileSync } from 'node:child_process' import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs' import os from 'node:os' import path from 'node:path' import type { Page } from '@stablyai/playwright-test' +import { runGit } from './helpers/git-fixture-command' import { test, expect } from './helpers/orca-app' import { waitForSessionReady } from './helpers/store' @@ -28,10 +28,6 @@ type ScrollProbeSample = { const FILE_COUNT = 18 const ADDED_LINES_PER_FILE = 180 -function runGit(repoPath: string, args: string[]): void { - execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' }) -} - function buildBaseFile(fileIndex: number): string { return `${Array.from( { length: 20 }, diff --git a/tests/e2e/helpers/git-fixture-command.ts b/tests/e2e/helpers/git-fixture-command.ts new file mode 100644 index 00000000000..5c8bd9853cd --- /dev/null +++ b/tests/e2e/helpers/git-fixture-command.ts @@ -0,0 +1,5 @@ +import { execFileSync } from 'node:child_process' + +export function runGit(repoPath: string, args: string[]): void { + execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' }) +} diff --git a/tests/e2e/large-diff-repro-fixtures.ts b/tests/e2e/large-diff-repro-fixtures.ts index 7ae422f2b20..7eb4aa46764 100644 --- a/tests/e2e/large-diff-repro-fixtures.ts +++ b/tests/e2e/large-diff-repro-fixtures.ts @@ -1,8 +1,8 @@ -import { execFileSync } from 'node:child_process' +import { randomUUID } from 'node:crypto' import { mkdirSync, mkdtempSync, realpathSync, writeFileSync } from 'node:fs' import os from 'node:os' import path from 'node:path' -import { randomUUID } from 'node:crypto' +import { runGit } from './helpers/git-fixture-command' export type IsolatedLargeDiffRepo = { repoPath: string @@ -15,10 +15,6 @@ export type IsolatedStagedLocaleDiffRepo = { relativePaths: string[] } -function runGit(repoPath: string, args: string[]): void { - execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' }) -} - export function createIsolatedLargeDiffRepo(): IsolatedLargeDiffRepo { const repoPath = realpathSync(mkdtempSync(path.join(os.tmpdir(), 'orca-large-diff-repro-'))) runGit(repoPath, ['init']) diff --git a/tests/e2e/large-file-count-fixtures.ts b/tests/e2e/large-file-count-fixtures.ts index f9927ac3e12..ad8a963f018 100644 --- a/tests/e2e/large-file-count-fixtures.ts +++ b/tests/e2e/large-file-count-fixtures.ts @@ -1,7 +1,7 @@ -import { execFileSync } from 'node:child_process' import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs' import os from 'node:os' import path from 'node:path' +import { runGit } from './helpers/git-fixture-command' export type LargeFileCountRepoOptions = { /** Files committed on the initial commit. */ @@ -27,10 +27,6 @@ export type LargeFileCountRepo = { modifiedFiles: number } -function runGit(repoPath: string, args: string[]): void { - execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' }) -} - /** * Removes a fixture repo, retrying ENOTEMPTY/EBUSY races: the app's git status * poll can still be writing index.lock (or the watcher holding dirs) while the diff --git a/tests/e2e/new-workspace-cross-project-dialog.spec.ts b/tests/e2e/new-workspace-cross-project-dialog.spec.ts index fa09b2b348a..868e0fcc313 100644 --- a/tests/e2e/new-workspace-cross-project-dialog.spec.ts +++ b/tests/e2e/new-workspace-cross-project-dialog.spec.ts @@ -1,7 +1,7 @@ -import { execFileSync } from 'node:child_process' import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' import os from 'node:os' import path from 'node:path' +import { runGit } from './helpers/git-fixture-command' import { test, expect } from './helpers/orca-app' import { waitForActiveWorktree, waitForSessionReady } from './helpers/store' @@ -9,10 +9,6 @@ const LONG_REPOSITORY_NAME = 'cross-project-dialog-long-repository-name'.repeat( const LONG_REPOSITORY_SLUG = LONG_REPOSITORY_NAME const CURRENT_REPOSITORY_NAME = 'current-project-name'.repeat(3) -function runGit(repositoryPath: string, args: string[]): void { - execFileSync('git', args, { cwd: repositoryPath, stdio: 'pipe' }) -} - function createGitRepository(repositoryPath: string): void { mkdirSync(repositoryPath, { recursive: true }) runGit(repositoryPath, ['init']) diff --git a/tests/e2e/new-workspace-linked-item-project-switch.spec.ts b/tests/e2e/new-workspace-linked-item-project-switch.spec.ts index 9970f3696f0..eef0289c495 100644 --- a/tests/e2e/new-workspace-linked-item-project-switch.spec.ts +++ b/tests/e2e/new-workspace-linked-item-project-switch.spec.ts @@ -12,11 +12,11 @@ * field pill re-render path. */ -import { execFileSync } from 'node:child_process' import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' import os from 'node:os' import path from 'node:path' import type { Page } from '@stablyai/playwright-test' +import { runGit } from './helpers/git-fixture-command' import { test, expect } from './helpers/orca-app' import { waitForActiveWorktree, waitForSessionReady } from './helpers/store' import type { LinkedWorkItemSummary } from '../../src/renderer/src/lib/new-workspace' @@ -24,10 +24,6 @@ import type { TaskSourceContext } from '../../src/shared/task-source-context' const SECOND_PROJECT_NAME = 'linked-item-second-project' -function runGit(repoPath: string, args: string[]): void { - execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' }) -} - function createGitRepo(repoPath: string): void { mkdirSync(repoPath, { recursive: true }) runGit(repoPath, ['init']) diff --git a/tests/e2e/setup-script-import.spec.ts b/tests/e2e/setup-script-import.spec.ts index 180b34f85aa..b3c91c1ef66 100644 --- a/tests/e2e/setup-script-import.spec.ts +++ b/tests/e2e/setup-script-import.spec.ts @@ -1,14 +1,10 @@ -import { execFileSync } from 'node:child_process' import { mkdirSync, rmSync, writeFileSync } from 'node:fs' import path from 'node:path' import type { Locator, Page } from '@stablyai/playwright-test' +import { runGit } from './helpers/git-fixture-command' import { test, expect } from './helpers/orca-app' import { waitForActiveWorktree, waitForSessionReady } from './helpers/store' -function runGit(repoPath: string, args: string[]): void { - execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' }) -} - function createGitRepo(repoPath: string): void { rmSync(repoPath, { recursive: true, force: true }) mkdirSync(repoPath, { recursive: true }) diff --git a/tests/e2e/setup-script-prompt-unreadable-orca-yaml.spec.ts b/tests/e2e/setup-script-prompt-unreadable-orca-yaml.spec.ts index 151a4b02bbc..bf3b6b3c958 100644 --- a/tests/e2e/setup-script-prompt-unreadable-orca-yaml.spec.ts +++ b/tests/e2e/setup-script-prompt-unreadable-orca-yaml.spec.ts @@ -1,7 +1,7 @@ -import { execFileSync } from 'node:child_process' import { mkdirSync, rmSync, writeFileSync } from 'node:fs' import path from 'node:path' import type { ElectronApplication, Page } from '@stablyai/playwright-test' +import { runGit } from './helpers/git-fixture-command' import { test, expect } from './helpers/orca-app' import { waitForActiveWorktree, waitForSessionReady } from './helpers/store' import { worktreeRow, worktreeRowSurface } from './worktree-row-locators' @@ -16,10 +16,6 @@ type WorktreeIds = { featureWorktreeId: string } -function runGit(cwd: string, args: string[]): void { - execFileSync('git', args, { cwd, stdio: 'pipe' }) -} - /** Repo whose shared orca.yaml carries a real setup script, plus a second worktree. */ function createRepoWithSharedSetupScript(repoPath: string, featureWorktreePath: string): void { rmSync(repoPath, { recursive: true, force: true })