Skip to content

fix(test): use unlinkSync to clean up samples/webapp symlink#50

Open
jonchurch wants to merge 1 commit into
vercel-labs:mainfrom
jonchurch:fix/bundle-test-symlink-cleanup
Open

fix(test): use unlinkSync to clean up samples/webapp symlink#50
jonchurch wants to merge 1 commit into
vercel-labs:mainfrom
jonchurch:fix/bundle-test-symlink-cleanup

Conversation

@jonchurch
Copy link
Copy Markdown

@jonchurch jonchurch commented May 5, 2026

What changed

Use fs.unlinkSync to remove the symlink, to avoid mac os error on trying to rmSync a dir without recursive: true.

Wrap fs.unlinkSync in try/catch to preserve the previous idempotent behavior of rmSync(link, {force: true}) (swallow any errors if the link is already gone)

Why

closes #51

The tests currently fail on mac os with an uncaught error during cleanup.

Error: Path is a directory

Mac is choking on the symlink resolving to a dir, so doesnt like fs.rmSync without {recursive: true}.

 FAIL   e2e  bundle.test.ts > bundle e2e > samples/webapp/ — config loads and custom matchers register
Error: Path is a directory: ~/Forks/deepsec/samples/webapp/node_modules
 ❯ bundle.test.ts:155:10
    153|       expect(stdout).toContain("webapp-route-no-rate-limit");
    154|     } finally {
    155|       fs.rmSync(link, { force: true });
       |          ^
    156|       fs.rmSync(path.join(sampleDir, "data"), { recursive: true, force: true });
    157|     }

Verification

  • pnpm test passes
  • pnpm lint passes
  • pnpm knip passes
  • If this adds a matcher: ran it against at least one real repo and confirmed the candidate count is sane

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@jonchurch is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests failing on Mac

1 participant