test: canonicalize native Windows paths during repository teardown (#19064)

This commit is contained in:
Neil
2026-09-06 03:29:05 -07:00
committed by GitHub
parent ec64df335e
commit adcc30be3b
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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)