From adcc30be3bc2a0bae7bc0f6cdd1bf55c7815f407 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 6 Sep 2026 03:29:05 -0700 Subject: [PATCH] test: canonicalize native Windows paths during repository teardown (#19064) --- tests/e2e/global-teardown.ts | 6 +++--- tests/e2e/global-teardown.unit.test.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/global-teardown.ts b/tests/e2e/global-teardown.ts index 63248cd36c8..0961eb0ee5c 100644 --- a/tests/e2e/global-teardown.ts +++ b/tests/e2e/global-teardown.ts @@ -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) diff --git a/tests/e2e/global-teardown.unit.test.ts b/tests/e2e/global-teardown.unit.test.ts index b5fabfe3de8..fde77199434 100644 --- a/tests/e2e/global-teardown.unit.test.ts +++ b/tests/e2e/global-teardown.unit.test.ts @@ -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)