Commit cd30888
committed
fix(test): canonicalize temp paths so imagine dryRun perFile passes on macOS (symlinked tmpdir)
dryRun() attributes test failures to files by string-matching node --test's
`location:` diagnostic (a canonical realpath) against join(wt, testfile). On
macOS the sandbox worktree lives under tmpdir(), which is itself a symlink
(/var → /private/var, /tmp → /private/tmp), so the raw wt path never matched
the realpath'd locations: attribution failed, perFile was omitted, and
test/imagine.test.js "dryRun executes the suite in an ephemeral worktree and
removes it (pass + fail)" saw perFile === undefined instead of the expected
{ "test/pass.test.js": "pass", "test/fail.test.js": "fail" }.
Fix the code (not the test): realpathSync(wt) once after the worktree is
created and compare against that canonical root. On Linux (no symlinked tmpdir)
this is a no-op. Re-enable the full unit suite on macos-latest in smoke.yml.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KfCEnSJzSG914yyVesjjD61 parent 4348e51 commit cd30888
3 files changed
Lines changed: 22 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
52 | 49 | | |
53 | | - | |
54 | 50 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
| |||
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
199 | | - | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
0 commit comments