mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
test(runtime): keep inherited GIT_* env from aiming worktree-removal tests at an outer repo (#35853)
This commit is contained in:
@@ -201,6 +201,10 @@ async function failInSession(): Promise<unknown> {
|
||||
|
||||
describe.skipIf(process.platform !== 'darwin')('a worktree delete Git fails partway', () => {
|
||||
beforeEach(async () => {
|
||||
// A git hook's GIT_DIR/GIT_INDEX_FILE would point the scratch repo's git, and Orca's, at the outer repo.
|
||||
for (const key of Object.keys(process.env).filter((name) => name.startsWith('GIT_'))) {
|
||||
vi.stubEnv(key, undefined)
|
||||
}
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
scratchDir = await realpath(await mkdtemp(join(tmpdir(), 'orca-failed-removal-')))
|
||||
recordsDir = join(scratchDir, 'profile')
|
||||
@@ -228,6 +232,7 @@ describe.skipIf(process.platform !== 'darwin')('a worktree delete Git fails part
|
||||
_resetPendingWorktreeRemovalsForTests()
|
||||
vi.mocked(removeHostTree).mockClear()
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllEnvs()
|
||||
await setImmutable(false, scratchDir)
|
||||
expect((await execFileAsync('find', [scratchDir, '-flags', '+uchg'])).stdout).toBe('')
|
||||
await removeTree(scratchDir)
|
||||
|
||||
Reference in New Issue
Block a user