Skip to content

fix(next): skip test files in the automatic route-definition scan - #70

Merged
JasonPaff merged 2 commits into
mainfrom
jasonpaff/par-115-route-definition-discovery-evaluates-test-files
Oct 2, 2026
Merged

JasonPaff merged 2 commits into
mainfrom
jasonpaff/par-115-route-definition-discovery-evaluates-test-files

Conversation

@JasonPaff

Copy link
Copy Markdown
Owner

paramour list and paramour doctor evaluate every source file that mentions defineAppRoute/definePagesRoute. Tests of route codecs mention them too. In the Cadence rc trial (PAR-3), src/lib/route-codecs.test.ts was loaded through jiti outside vitest. With aliases resolving (#69), it ran its top-level code and failed with Cannot read properties of undefined (reading 'config').

Change

  • The automatic scan now ignores **/*.{test,spec}.* and **/__tests__/**.
  • Explicit routeFiles globs keep only the output-directory ignores, so a project can still name a test file on purpose.
  • reference/next/cli/list.mdx documents the skip.

Verification

  • New list.test.ts cases: a .test.ts, a .spec.mts and a __tests__/ module each write a marker file when evaluated, and no marker appears after list. This test fails without the fix. A second case shows routeFiles can still name defs/a.test.ts.
  • pnpm test packages/next: 543 passed, 1 skipped. Typecheck and lint are clean.

The docs edit is on a different line from #69's, so the two PRs merge independently.

Fixes PAR-115

🤖 Generated with Claude Code

The scan loads any .ts/.js file that mentions defineAppRoute, which includes
tests of route codecs. In the Cadence rc trial, list/doctor evaluated a
vitest file outside its runner. The automatic scan now ignores *.test.*,
*.spec.* and __tests__/. Explicit routeFiles globs are taken as written.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
paramour-docs Ready Ready Preview Oct 2, 2026 9:35pm UTC

@JasonPaff
JasonPaff merged commit 5c25ee5 into main Oct 2, 2026
12 of 13 checks passed
@JasonPaff
JasonPaff deleted the jasonpaff/par-115-route-definition-discovery-evaluates-test-files branch October 2, 2026 21:34

This branch was successfully deployed

1 active deployment
Preview — 923957e7 Deployed Oct 2, 2026 by vercel[bot]
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.

1 participant