From a54536ed06aa10117c86bcca49cff0633895b27a Mon Sep 17 00:00:00 2001 From: Yurii Yukhymenko Date: Sun, 4 Oct 2026 14:13:46 +0300 Subject: [PATCH] fix: resolve tmpdir symlink in describeInstallLocation fixture (macOS flake) On macOS tmpdir() is /var/folders/..., a system symlink to /private/var/folders/..., so the fixture dir the test passes as installDir is itself a symlink hop. describeInstallLocation's realpath then legitimately reports it (real=...), and the plain case's doesNotMatch(/real=/) assertion fails deterministically. Realpath the fixture dir so the plain case stays plain on every platform; the link case below already compared via realpathSync. Fixes #2068 --- tests/update-install-dir.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/update-install-dir.test.ts b/tests/update-install-dir.test.ts index 481ad79f5c..2b3a63bbce 100644 --- a/tests/update-install-dir.test.ts +++ b/tests/update-install-dir.test.ts @@ -117,7 +117,11 @@ test("findInstallDir: resolves this running copy's own root", async () => { }); test("describeInstallLocation: names target, symlink real, and running module", async () => { - const base = mkdtempSync(path.join(tmpdir(), "bc-installdir-")); + // Resolve the fixture dir itself: on macOS tmpdir() is /var/folders/…, a + // system symlink to /private/var/folders/…, which the implementation's + // realpath legitimately reports — making the "plain" case look like a + // symlink hop and flaking the /real=/ assertion below (#2068). + const base = realpathSync(mkdtempSync(path.join(tmpdir(), "bc-installdir-"))); try { const real = path.join(base, "global", "node_modules", PKG); writePkg(real, { name: PKG, version: "0.1.129" });