Skip to content

Commit c6459ae

Browse files
khipu-agentEsteban Espin
andauthored
test(tools): compare child cwd against its real path (#47)
The passthrough test compared the child's process.cwd() (a resolved physical path) against the symlinked temp dir spelling, so the suite was red on macOS where os.tmpdir() is /var/... (a symlink to /private/var/...). Compare against realpathSync(cwd) — a no-op on platforms without the symlink. Co-authored-by: Esteban Espin <estebanespin@MacBook-Air-de-Esteban.local>
1 parent 3673d3e commit c6459ae

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/tools.test.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
mkdirSync,
77
openSync,
88
readFileSync,
9+
realpathSync,
910
writeFileSync,
1011
} from "node:fs";
1112
import { tmpdir } from "node:os";
@@ -126,7 +127,10 @@ process.exit(23);
126127
assert.deepEqual(JSON.parse(result.stdout), {
127128
argv: ["--json", "two words", "--flag=value"],
128129
input: "native stdin",
129-
cwd,
130+
// The child reports process.cwd() — the resolved physical path, while
131+
// `cwd` may pass through a symlink (macOS: /var → /private/var), so
132+
// compare against the real path, not the symlinked spelling.
133+
cwd: realpathSync(cwd),
130134
marker: "preserved",
131135
});
132136
assert.equal(result.stderr, "native stderr");

0 commit comments

Comments
 (0)