test(server): entrypoint symlink case asserts unrealpath'd module URL — fails on macOS (/var → /private/var)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
apps/server/src/entrypoint.test.ts — "matches through a symlinked entrypoint, as npm and npx install it" fails deterministically on macOS.
The test does:
const dir = mkdtempSync(join(tmpdir(), "t3-entrypoint-test-"));
const real = join(dir, "bin.mjs");
const link = join(dir, "t3");
writeFileSync(real, "");
symlinkSync(real, link);
expect(isEntrypoint({ moduleUrl: pathToFileURL(real).href, entryPath: link, runtimeMain: undefined })).toBe(true);
The implementation (entrypoint.ts:34) compares moduleUrl === pathToFileURL(realpathSync(entryPath)).href. On macOS $TMPDIR is under /var/folders/… and /var is a symlink to /private/var, so realpathSync(entryPath) resolves to /private/var/folders/…/bin.mjs while pathToFileURL(real).href stays /var/folders/…/bin.mjs — the strings can never be equal, so the assertion gets false instead of true.
The product code is correct: canonicalizing the entry path is exactly what makes npm/npx-style symlinked entrypoints match. The fixture is what needs the realpath — e.g. pathToFileURL(realpathSync(real)).href, or realpath the temp dir when creating it — so the test isolates the symlink resolution it intends to exercise from macOS's own /var → /private/var symlink. Linux CI is unaffected, which is why this only surfaces running the suite locally on macOS.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/server/src/entrypoint.test.ts and the test named "matches through a symlinked entrypoint, as npm and npx install it"; compare its temporary-path fixture with entrypoint.ts:34 and the existing isEntrypoint behavior. Run the focused test on macOS, then confirm the fixture passes while preserving the symlink-resolution assertion and remaining green on Linux.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100