mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
test: canonicalize native Windows paths during repository teardown (#19064)
This commit is contained in:
@@ -10,7 +10,7 @@ import { readFileSync, existsSync, realpathSync, rmSync } from 'node:fs'
|
||||
import { TEST_REPO_PATH_FILE } from './global-setup'
|
||||
|
||||
export function linkedWorktreePaths(testRepoDir: string): string[] {
|
||||
const root = realpathSync(testRepoDir)
|
||||
const root = realpathSync.native(testRepoDir)
|
||||
const output = execFileSync('git', ['-C', testRepoDir, 'worktree', 'list', '--porcelain'], {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
@@ -23,7 +23,7 @@ export function linkedWorktreePaths(testRepoDir: string): string[] {
|
||||
if (!existsSync(recordedPath)) {
|
||||
continue
|
||||
}
|
||||
const canonicalPath = realpathSync(recordedPath)
|
||||
const canonicalPath = realpathSync.native(recordedPath)
|
||||
if (canonicalPath !== root) {
|
||||
linked.add(canonicalPath)
|
||||
}
|
||||
@@ -32,7 +32,7 @@ export function linkedWorktreePaths(testRepoDir: string): string[] {
|
||||
}
|
||||
|
||||
export function cleanupTestRepository(testRepoDir: string): void {
|
||||
const root = realpathSync(testRepoDir)
|
||||
const root = realpathSync.native(testRepoDir)
|
||||
let worktreePaths: string[] = []
|
||||
try {
|
||||
worktreePaths = linkedWorktreePaths(root)
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('E2E global teardown ownership', () => {
|
||||
git(repoPath, ['worktree', 'add', '-b', 'second-owned', secondWorktreePath])
|
||||
|
||||
expect(new Set(linkedWorktreePaths(repoPath))).toEqual(
|
||||
new Set([realpathSync(firstWorktreePath), realpathSync(secondWorktreePath)])
|
||||
new Set([realpathSync.native(firstWorktreePath), realpathSync.native(secondWorktreePath)])
|
||||
)
|
||||
cleanupTestRepository(repoPath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user