mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* refactor(git): group root modules by concrete domain owners * chore(git): reconcile retired-test metadata with owner cleanup
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const { execFileMock } = vi.hoisted(() => ({ execFileMock: vi.fn() }))
|
|
vi.mock('node:child_process', () => ({
|
|
execFile: execFileMock,
|
|
execFileSync: vi.fn(),
|
|
spawn: vi.fn()
|
|
}))
|
|
|
|
import { gitExecFileAsyncBuffer } from './git-exec-file'
|
|
|
|
import { _resetGitAdmissionForTests } from './admission/git-subprocess-admission'
|
|
import { configureWindowsHostGitEnvironmentReadiness } from './host-routing/windows-host-git-environment'
|
|
|
|
beforeEach(() => execFileMock.mockReset())
|
|
afterEach(() => {
|
|
_resetGitAdmissionForTests()
|
|
configureWindowsHostGitEnvironmentReadiness(null)
|
|
})
|
|
|
|
describe('buffered Git cancellation', () => {
|
|
it('cancels Windows environment readiness without launching Git', async () => {
|
|
const platform = process.platform
|
|
Object.defineProperty(process, 'platform', { configurable: true, value: 'win32' })
|
|
try {
|
|
configureWindowsHostGitEnvironmentReadiness(() => new Promise(() => {}))
|
|
const controller = new AbortController()
|
|
const read = gitExecFileAsyncBuffer(['show', 'HEAD:file'], {
|
|
cwd: String.raw`C:\repo`,
|
|
signal: controller.signal
|
|
})
|
|
const rejected = expect(read).rejects.toMatchObject({ name: 'AbortError' })
|
|
controller.abort()
|
|
await rejected
|
|
expect(execFileMock).not.toHaveBeenCalled()
|
|
} finally {
|
|
Object.defineProperty(process, 'platform', { configurable: true, value: platform })
|
|
}
|
|
})
|
|
})
|