[Bug] gh-pr-worktree tests fail on macOS because the temp dir is a symlink
Description
Two tests in source/commands/gh-pr-worktree.spec.ts fail on macOS on a clean main:
- entering the worktree makes it the session cwd and project root
- real Git worktree makes relative file reads use the PR head and preserves a dirty launch checkout
On macOS tmpdir() is /var/folders/..., which is a symlink to /private/var/folders/.... After process.chdir, process.cwd() returns the resolved path, so the t.is path comparisons don't match.
Environment
- OS: macOS 27.0
- Node version: v24.1.0
- Nanocoder version: main
Steps to Reproduce
pnpm build
npx ava source/commands/gh-pr-worktree.spec.ts
Expected Behavior
All 14 tests pass.
Actual Behavior
2 tests fail:
- '/private/var/folders/.../nanocoder-pr-test-...-pr-42'
+ '/var/folders/.../nanocoder-pr-test-...-pr-42'
With TMPDIR=$(realpath $TMPDIR)/ all 14 pass.
Suggested fix
Resolve the fixture roots with realpathSync(mkdtempSync(...)) (lines 20 and 256). Happy to send a PR for this.
I can take this issue. The reproduction and suggested fixture-path normalization are clear; I’ll prepare a small regression-focused PR and rely on the project’s checks for validation.
Fixed by ef41e8a on main — thanks @will-lamerton! Closing.